@kubb/plugin-zod 5.0.0-beta.3 → 5.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -5
- package/dist/index.cjs +644 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +103 -34
- package/dist/index.js +640 -199
- package/dist/index.js.map +1 -1
- package/extension.yaml +968 -0
- package/package.json +10 -13
- package/src/components/Operations.tsx +6 -5
- package/src/components/Zod.tsx +1 -1
- package/src/generators/zodGenerator.tsx +210 -60
- package/src/plugin.ts +23 -20
- package/src/printers/printerZod.ts +91 -68
- package/src/printers/printerZodMini.ts +46 -49
- package/src/resolvers/resolverZod.ts +31 -19
- package/src/types.ts +57 -21
- package/src/utils.ts +113 -36
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1
|
|
2
|
+
<h1>@kubb/plugin-zod</h1>
|
|
3
3
|
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
4
|
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
5
|
</a>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
12
|
|
|
13
13
|
<h4>
|
|
14
|
-
<a href="https://codesandbox.io/s/github/kubb-labs/
|
|
14
|
+
<a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/zod" target="_blank">View Demo</a>
|
|
15
15
|
<span> · </span>
|
|
16
|
-
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
16
|
+
<a href="https://kubb.dev/plugins/zod" target="_blank">Documentation</a>
|
|
17
17
|
<span> · </span>
|
|
18
18
|
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
19
19
|
<span> · </span>
|
|
@@ -21,11 +21,31 @@
|
|
|
21
21
|
</h4>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
`@kubb/plugin-zod` generates Zod validation schemas from your OpenAPI specification. Each schema becomes a Zod object you can use to parse and validate data at runtime.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Generates one Zod schema per OpenAPI schema
|
|
29
|
+
- Supports both `.parse()` for strict validation and `.safeParse()` for error handling
|
|
30
|
+
- Derives schemas from the same OpenAPI source as `@kubb/plugin-ts`, so types stay in sync
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bun add @kubb/plugin-zod
|
|
36
|
+
# or
|
|
37
|
+
pnpm add @kubb/plugin-zod
|
|
38
|
+
# or
|
|
39
|
+
npm install @kubb/plugin-zod
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
See the [full documentation](https://kubb.dev/plugins/zod) for configuration options and examples.
|
|
25
45
|
|
|
26
46
|
## Supporting Kubb
|
|
27
47
|
|
|
28
|
-
Kubb
|
|
48
|
+
Kubb is an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
29
49
|
|
|
30
50
|
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
31
51
|
|