@kubb/plugin-zod 3.8.0 → 3.9.1

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.
Files changed (71) hide show
  1. package/dist/{chunk-VPOWWZEW.js → chunk-3KBN4WTO.js} +71 -36
  2. package/dist/chunk-3KBN4WTO.js.map +1 -0
  3. package/dist/{chunk-DKAOGAVN.cjs → chunk-7GPORWCL.cjs} +70 -35
  4. package/dist/chunk-7GPORWCL.cjs.map +1 -0
  5. package/dist/{chunk-BWBRIHPY.cjs → chunk-F3XH7OGO.cjs} +50 -29
  6. package/dist/chunk-F3XH7OGO.cjs.map +1 -0
  7. package/dist/{chunk-2JCBW3TA.js → chunk-WS5LFZBH.js} +49 -28
  8. package/dist/chunk-WS5LFZBH.js.map +1 -0
  9. package/dist/components.cjs +3 -3
  10. package/dist/components.js +1 -1
  11. package/dist/generators.cjs +4 -4
  12. package/dist/generators.js +2 -2
  13. package/dist/index.cjs +3 -3
  14. package/dist/index.js +2 -2
  15. package/dist/utils.d.cts +1 -1
  16. package/dist/utils.d.ts +1 -1
  17. package/package.json +12 -12
  18. package/src/components/Zod.tsx +12 -11
  19. package/src/generators/__snapshots__/anyof.ts +4 -0
  20. package/src/generators/__snapshots__/coercion.ts +4 -0
  21. package/src/generators/__snapshots__/coercionDates.ts +4 -0
  22. package/src/generators/__snapshots__/coercionNumbers.ts +4 -0
  23. package/src/generators/__snapshots__/coercionStrings.ts +4 -0
  24. package/src/generators/__snapshots__/createPet.ts +4 -0
  25. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +4 -0
  26. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown_wrapOutput.ts +4 -0
  27. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown_wrapOutput_entire_.ts +4 -0
  28. package/src/generators/__snapshots__/createPet_wrapOutput.ts +4 -0
  29. package/src/generators/__snapshots__/deletePet.ts +4 -0
  30. package/src/generators/__snapshots__/deletePet_wrapOutput.ts +4 -0
  31. package/src/generators/__snapshots__/discriminator.ts +4 -0
  32. package/src/generators/__snapshots__/enumBooleanLiteral.ts +4 -0
  33. package/src/generators/__snapshots__/enumNamesType.ts +4 -0
  34. package/src/generators/__snapshots__/enumNullable.ts +4 -0
  35. package/src/generators/__snapshots__/enumSingleLiteral.ts +4 -0
  36. package/src/generators/__snapshots__/enumVarNamesType.ts +4 -0
  37. package/src/generators/__snapshots__/example.ts +4 -0
  38. package/src/generators/__snapshots__/getPets.ts +4 -0
  39. package/src/generators/__snapshots__/getPets_wrapOutput.ts +4 -0
  40. package/src/generators/__snapshots__/mixedValueTypeConst.ts +4 -0
  41. package/src/generators/__snapshots__/nullableString.ts +4 -0
  42. package/src/generators/__snapshots__/nullableStringUuid.ts +4 -0
  43. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +4 -0
  44. package/src/generators/__snapshots__/numberValueConst.ts +4 -0
  45. package/src/generators/__snapshots__/oneof.ts +4 -0
  46. package/src/generators/__snapshots__/operations.ts +4 -0
  47. package/src/generators/__snapshots__/optionalPetInfer.ts +4 -0
  48. package/src/generators/__snapshots__/optionalPetTyped.ts +4 -0
  49. package/src/generators/__snapshots__/order.ts +4 -0
  50. package/src/generators/__snapshots__/orderDateTypeFalse.ts +4 -0
  51. package/src/generators/__snapshots__/orderDateTypeString.ts +4 -0
  52. package/src/generators/__snapshots__/pet.ts +4 -0
  53. package/src/generators/__snapshots__/petArray.ts +4 -0
  54. package/src/generators/__snapshots__/petCoercion.ts +4 -0
  55. package/src/generators/__snapshots__/petTupleObject.ts +4 -0
  56. package/src/generators/__snapshots__/petWithMapper.ts +4 -0
  57. package/src/generators/__snapshots__/pets.ts +4 -0
  58. package/src/generators/__snapshots__/recursive.ts +4 -0
  59. package/src/generators/__snapshots__/showPetById.ts +4 -0
  60. package/src/generators/__snapshots__/showPetById_wrapOutput.ts +4 -0
  61. package/src/generators/__snapshots__/stringValueConst.ts +4 -0
  62. package/src/generators/__snapshots__/toy.ts +4 -0
  63. package/src/generators/__snapshots__/uuidSchema.ts +4 -0
  64. package/src/generators/operationsGenerator.tsx +7 -1
  65. package/src/generators/zodGenerator.tsx +9 -2
  66. package/src/parser.ts +71 -30
  67. package/src/utils/ToZod.ts +1 -2
  68. package/dist/chunk-2JCBW3TA.js.map +0 -1
  69. package/dist/chunk-BWBRIHPY.cjs.map +0 -1
  70. package/dist/chunk-DKAOGAVN.cjs.map +0 -1
  71. package/dist/chunk-VPOWWZEW.js.map +0 -1
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const deletePetsPetidMutationResponse = z.any()
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  export const deletePetsPetidMutationResponse = z.any()
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const advanced = z.union([
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const enumBooleanLiteral = z.union([z.literal(true), z.literal(false)])
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const enumNamesType = z.enum(['0', '1'])
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const enumNullable = z.enum(['Pending', 'Received']).nullable()
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const enumSingleLiteral = z.literal(0)
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const enumVarNamesType = z.union([z.literal(0), z.literal(1)])
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const example = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const listPetsQueryParams = z
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  export const listPetsQueryParams = z
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const nullableString = z.string().nullable()
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const nullableStringUuid = z.string().uuid().nullable()
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const nullableStringWithAnyOf = z.union([z.string(), z.null()])
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const test = z.union([
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import {
2
6
  listPets200,
3
7
  listPetsQueryResponse,
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const optionalPet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import type { ToZod } from '@kubb/plugin-zod/utils'
2
6
  import { z } from 'zod'
3
7
 
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const order = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const order = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const order = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const pet = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import type { ToZod } from '@kubb/plugin-zod/utils'
2
6
  import { z } from 'zod'
3
7
 
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const example = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const showPetByIdPathParams = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from '@hono/zod-openapi'
2
6
 
3
7
  export const showPetByIdPathParams = z.object({
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  /**
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const toy = z
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
1
5
  import { z } from 'zod'
2
6
 
3
7
  export const uuidSchema = z.string().uuid()
@@ -32,7 +32,13 @@ export const operationsGenerator = createReactGenerator<PluginZod>({
32
32
  .filter(Boolean)
33
33
 
34
34
  return (
35
- <File baseName={file.baseName} path={file.path} meta={file.meta} banner={getBanner({ oas, output })} footer={getFooter({ oas, output })}>
35
+ <File
36
+ baseName={file.baseName}
37
+ path={file.path}
38
+ meta={file.meta}
39
+ banner={getBanner({ oas, output, config: pluginManager.config })}
40
+ footer={getFooter({ oas, output })}
41
+ >
36
42
  {imports}
37
43
  <Operations name={name} operations={transformedOperations} />
38
44
  </File>
@@ -84,7 +84,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
84
84
  baseName={file.baseName}
85
85
  path={file.path}
86
86
  meta={file.meta}
87
- banner={getBanner({ oas, output: plugin.options.output })}
87
+ banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}
88
88
  footer={getFooter({ oas, output: plugin.options.output })}
89
89
  >
90
90
  <File.Import name={['z']} path={plugin.options.importPath} />
@@ -97,6 +97,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
97
97
 
98
98
  const { getName, getFile, getImports } = useSchemaManager()
99
99
  const {
100
+ pluginManager,
100
101
  plugin: {
101
102
  options: { output },
102
103
  },
@@ -117,7 +118,13 @@ export const zodGenerator = createReactGenerator<PluginZod>({
117
118
  }
118
119
 
119
120
  return (
120
- <File baseName={zod.file.baseName} path={zod.file.path} meta={zod.file.meta} banner={getBanner({ oas, output })} footer={getFooter({ oas, output })}>
121
+ <File
122
+ baseName={zod.file.baseName}
123
+ path={zod.file.path}
124
+ meta={zod.file.meta}
125
+ banner={getBanner({ oas, output, config: pluginManager.config })}
126
+ footer={getFooter({ oas, output })}
127
+ >
121
128
  <File.Import name={['z']} path={importPath} />
122
129
  {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}
123
130
  {typed && <File.Import isTypeOnly path={'@kubb/plugin-zod/utils'} name={['ToZod']} />}