@kubb/plugin-zod 3.0.0-alpha.18 → 3.0.0-alpha.19
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/dist/{chunk-ZVLPHBJB.cjs → chunk-EZIBUHZO.cjs} +51 -39
- package/dist/chunk-EZIBUHZO.cjs.map +1 -0
- package/dist/{chunk-Y7E62IFJ.js → chunk-GZX3ETVC.js} +28 -16
- package/dist/chunk-GZX3ETVC.js.map +1 -0
- package/dist/{chunk-G5M2ERLS.cjs → chunk-IFCC7VQX.cjs} +4 -4
- package/dist/{chunk-G5M2ERLS.cjs.map → chunk-IFCC7VQX.cjs.map} +1 -1
- package/dist/{chunk-UPICPEOA.js → chunk-LOZEOT4J.js} +4 -4
- package/dist/{chunk-UPICPEOA.js.map → chunk-LOZEOT4J.js.map} +1 -1
- package/dist/components.cjs +3 -3
- package/dist/components.d.cts +1 -2
- package/dist/components.d.ts +1 -2
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -2
- package/dist/generators.d.ts +1 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/{types-29VBUXHk.d.cts → types-D7_wds1i.d.cts} +5 -23
- package/dist/{types-29VBUXHk.d.ts → types-D7_wds1i.d.ts} +5 -23
- package/package.json +10 -10
- package/src/generators/operationsGenerator.tsx +6 -3
- package/src/generators/zodGenerator.tsx +7 -2
- package/src/types.ts +5 -23
- package/dist/chunk-Y7E62IFJ.js.map +0 -1
- package/dist/chunk-ZVLPHBJB.cjs.map +0 -1
|
@@ -7,8 +7,11 @@ import type { PluginZod } from '../types'
|
|
|
7
7
|
|
|
8
8
|
export const operationsGenerator = createReactGenerator<PluginZod>({
|
|
9
9
|
name: 'operations',
|
|
10
|
-
Operations({ operations
|
|
11
|
-
const {
|
|
10
|
+
Operations({ operations }) {
|
|
11
|
+
const {
|
|
12
|
+
pluginManager,
|
|
13
|
+
plugin: { output },
|
|
14
|
+
} = useApp<PluginZod>()
|
|
12
15
|
const { getFile, groupSchemasByName } = useOperationManager()
|
|
13
16
|
|
|
14
17
|
const name = 'operations'
|
|
@@ -25,7 +28,7 @@ export const operationsGenerator = createReactGenerator<PluginZod>({
|
|
|
25
28
|
.filter(Boolean)
|
|
26
29
|
|
|
27
30
|
return (
|
|
28
|
-
<File baseName={file.baseName} path={file.path} meta={file.meta}>
|
|
31
|
+
<File baseName={file.baseName} path={file.path} meta={file.meta} banner={output?.banner} footer={output?.footer}>
|
|
29
32
|
{imports}
|
|
30
33
|
<Operations name={name} operations={transformedOperations} />
|
|
31
34
|
</File>
|
|
@@ -69,7 +69,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
|
-
<File baseName={file.baseName} path={file.path} meta={file.meta}>
|
|
72
|
+
<File baseName={file.baseName} path={file.path} meta={file.meta} banner={plugin.output?.banner} footer={plugin.output?.footer}>
|
|
73
73
|
<File.Import name={['z']} path={plugin.options.importPath} />
|
|
74
74
|
{operationSchemas.map(mapOperationSchema)}
|
|
75
75
|
</File>
|
|
@@ -77,7 +77,12 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
77
77
|
},
|
|
78
78
|
Schema({ schema, options }) {
|
|
79
79
|
const { coercion, inferred, typed, mapper, importPath } = options
|
|
80
|
+
|
|
80
81
|
const { getName, getFile, getImports } = useSchemaManager()
|
|
82
|
+
const {
|
|
83
|
+
plugin: { output },
|
|
84
|
+
} = useApp<PluginZod>()
|
|
85
|
+
|
|
81
86
|
const imports = getImports(schema.tree)
|
|
82
87
|
|
|
83
88
|
const zod = {
|
|
@@ -92,7 +97,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
return (
|
|
95
|
-
<File baseName={zod.file.baseName} path={zod.file.path} meta={zod.file.meta}>
|
|
100
|
+
<File baseName={zod.file.baseName} path={zod.file.path} meta={zod.file.meta} banner={output?.banner} footer={output?.footer}>
|
|
96
101
|
<File.Import name={['z']} path={importPath} />
|
|
97
102
|
{typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}
|
|
98
103
|
{imports.map((imp, index) => (
|
package/src/types.ts
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type * as KubbFile from '@kubb/fs/types'
|
|
1
|
+
import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
3
2
|
import type { SchemaObject } from '@kubb/oas'
|
|
4
3
|
import type { Exclude, Include, Override, ResolvePathOptions, Schema } from '@kubb/plugin-oas'
|
|
5
4
|
|
|
6
5
|
export type Options = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @default 'zod'
|
|
12
|
-
*/
|
|
13
|
-
path: string
|
|
14
|
-
/**
|
|
15
|
-
* Name to be used for the `export * as {{exportAs}} from './'`
|
|
16
|
-
*/
|
|
17
|
-
exportAs?: string
|
|
18
|
-
/**
|
|
19
|
-
* Add an extension to the generated imports and exports, default it will not use an extension
|
|
20
|
-
*/
|
|
21
|
-
extName?: KubbFile.Extname
|
|
22
|
-
/**
|
|
23
|
-
* Define what needs to exported, here you can also disable the export of barrel files
|
|
24
|
-
* @default `'barrel'`
|
|
25
|
-
*/
|
|
26
|
-
exportType?: 'barrel' | 'barrelNamed' | false
|
|
27
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* @default 'zod'
|
|
8
|
+
*/
|
|
9
|
+
output?: Output
|
|
28
10
|
/**
|
|
29
11
|
* Group the Zod schemas based on the provided name.
|
|
30
12
|
*/
|