@kubb/plugin-zod 5.0.0-beta.33 → 5.0.0-beta.36
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 +11 -10
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- /package/dist/{chunk--u3MIqq1.js → chunk-C0LytTxp.js} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1>@kubb/plugin-zod</h1>
|
|
3
2
|
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
-
<img
|
|
3
|
+
<img src="https://kubb.dev/og.png" alt="Kubb banner">
|
|
5
4
|
</a>
|
|
6
5
|
|
|
7
6
|
[![npm version][npm-version-src]][npm-version-href]
|
|
@@ -11,8 +10,6 @@
|
|
|
11
10
|
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
11
|
|
|
13
12
|
<h4>
|
|
14
|
-
<a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/zod" target="_blank">View Demo</a>
|
|
15
|
-
<span> · </span>
|
|
16
13
|
<a href="https://kubb.dev/plugins/zod" target="_blank">Documentation</a>
|
|
17
14
|
<span> · </span>
|
|
18
15
|
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
@@ -21,13 +18,13 @@
|
|
|
21
18
|
</h4>
|
|
22
19
|
</div>
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
<br />
|
|
22
|
+
|
|
23
|
+
# @kubb/plugin-zod
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
### Generate Zod schemas from OpenAPI
|
|
27
26
|
|
|
28
|
-
-
|
|
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
|
|
27
|
+
`@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.
|
|
31
28
|
|
|
32
29
|
## Installation
|
|
33
30
|
|
|
@@ -45,7 +42,7 @@ See the [full documentation](https://kubb.dev/plugins/zod) for configuration opt
|
|
|
45
42
|
|
|
46
43
|
## Supporting Kubb
|
|
47
44
|
|
|
48
|
-
Kubb is an
|
|
45
|
+
Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
|
|
49
46
|
|
|
50
47
|
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
51
48
|
|
|
@@ -55,6 +52,10 @@ Kubb is an MIT-licensed open source project with its ongoing development made po
|
|
|
55
52
|
</a>
|
|
56
53
|
</p>
|
|
57
54
|
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
[MIT](https://github.com/kubb-labs/plugins/blob/main/LICENSE)
|
|
58
|
+
|
|
58
59
|
<!-- Badges -->
|
|
59
60
|
|
|
60
61
|
[npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-zod?flat&colorA=18181B&colorB=f58517
|
package/dist/index.cjs
CHANGED
|
@@ -317,17 +317,17 @@ function resolveContentTypeVariants(entries, baseName) {
|
|
|
317
317
|
* - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
|
|
318
318
|
* - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
|
|
319
319
|
*
|
|
320
|
-
*
|
|
320
|
+
* A user-provided `group.name` always wins over the default namer, so callers stay in
|
|
321
|
+
* control of their output folders. Returns `null` when grouping is disabled, matching the
|
|
322
|
+
* per-plugin convention.
|
|
321
323
|
*
|
|
322
324
|
* @param group - The user-supplied group option, or `undefined` to disable grouping.
|
|
323
325
|
* @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
|
|
324
|
-
* @param options.honorName - When `true`, a user-provided `group.name` overrides the default namer.
|
|
325
326
|
*
|
|
326
327
|
* @example
|
|
327
328
|
* ```ts
|
|
328
|
-
* createGroupConfig(group, { suffix: 'Controller' })
|
|
329
|
-
* createGroupConfig(group, { suffix: '
|
|
330
|
-
* createGroupConfig(group, { suffix: 'Requests', honorName: true }) // plugin-cypress, plugin-mcp
|
|
329
|
+
* createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …
|
|
330
|
+
* createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp
|
|
331
331
|
* ```
|
|
332
332
|
*/
|
|
333
333
|
function createGroupConfig(group, options) {
|
|
@@ -338,7 +338,7 @@ function createGroupConfig(group, options) {
|
|
|
338
338
|
};
|
|
339
339
|
return {
|
|
340
340
|
...group,
|
|
341
|
-
name:
|
|
341
|
+
name: group.name ? group.name : defaultName
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
//#endregion
|