zod-openapi 2.8.0 → 2.9.0

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 (116) hide show
  1. package/README.md +1 -1
  2. package/lib-commonjs/create/document.js.map +1 -1
  3. package/lib-commonjs/create/parameters.js.map +1 -1
  4. package/lib-commonjs/create/schema/parsers/array.js.map +1 -1
  5. package/lib-commonjs/create/schema/parsers/brand.js.map +1 -1
  6. package/lib-commonjs/create/schema/parsers/catch.js.map +1 -1
  7. package/lib-commonjs/create/schema/parsers/default.js +3 -2
  8. package/lib-commonjs/create/schema/parsers/default.js.map +1 -1
  9. package/lib-commonjs/create/schema/parsers/discriminatedUnion.js.map +1 -1
  10. package/lib-commonjs/create/schema/parsers/enum.js +0 -1
  11. package/lib-commonjs/create/schema/parsers/enum.js.map +1 -1
  12. package/lib-commonjs/create/schema/parsers/intersection.js +1 -3
  13. package/lib-commonjs/create/schema/parsers/intersection.js.map +1 -1
  14. package/lib-commonjs/create/schema/parsers/lazy.js.map +1 -1
  15. package/lib-commonjs/create/schema/parsers/literal.js.map +1 -1
  16. package/lib-commonjs/create/schema/parsers/nativeEnum.js.map +1 -1
  17. package/lib-commonjs/create/schema/parsers/nullable.js +3 -1
  18. package/lib-commonjs/create/schema/parsers/nullable.js.map +1 -1
  19. package/lib-commonjs/create/schema/parsers/number.js +2 -4
  20. package/lib-commonjs/create/schema/parsers/number.js.map +1 -1
  21. package/lib-commonjs/create/schema/parsers/object.js +1 -1
  22. package/lib-commonjs/create/schema/parsers/object.js.map +1 -1
  23. package/lib-commonjs/create/schema/parsers/optional.js.map +1 -1
  24. package/lib-commonjs/create/schema/parsers/pipeline.js +4 -12
  25. package/lib-commonjs/create/schema/parsers/pipeline.js.map +1 -1
  26. package/lib-commonjs/create/schema/parsers/preprocess.js +1 -3
  27. package/lib-commonjs/create/schema/parsers/preprocess.js.map +1 -1
  28. package/lib-commonjs/create/schema/parsers/readonly.js +1 -3
  29. package/lib-commonjs/create/schema/parsers/readonly.js.map +1 -1
  30. package/lib-commonjs/create/schema/parsers/record.js +1 -2
  31. package/lib-commonjs/create/schema/parsers/record.js.map +1 -1
  32. package/lib-commonjs/create/schema/parsers/refine.js +1 -3
  33. package/lib-commonjs/create/schema/parsers/refine.js.map +1 -1
  34. package/lib-commonjs/create/schema/parsers/set.js.map +1 -1
  35. package/lib-commonjs/create/schema/parsers/string.js +64 -15
  36. package/lib-commonjs/create/schema/parsers/string.js.map +1 -1
  37. package/lib-commonjs/create/schema/parsers/transform.js.map +1 -1
  38. package/lib-commonjs/create/schema/parsers/tuple.js.map +1 -1
  39. package/lib-commonjs/create/schema/parsers/union.js +1 -2
  40. package/lib-commonjs/create/schema/parsers/union.js.map +1 -1
  41. package/lib-commonjs/extendZod.js +4 -4
  42. package/lib-commonjs/extendZod.js.map +1 -1
  43. package/lib-commonjs/zodType.js.map +1 -1
  44. package/lib-es2015/create/document.js.map +1 -1
  45. package/lib-es2015/create/parameters.js.map +1 -1
  46. package/lib-es2015/create/schema/parsers/array.js.map +1 -1
  47. package/lib-es2015/create/schema/parsers/brand.js.map +1 -1
  48. package/lib-es2015/create/schema/parsers/catch.js.map +1 -1
  49. package/lib-es2015/create/schema/parsers/default.js +3 -2
  50. package/lib-es2015/create/schema/parsers/default.js.map +1 -1
  51. package/lib-es2015/create/schema/parsers/discriminatedUnion.js.map +1 -1
  52. package/lib-es2015/create/schema/parsers/enum.js +0 -1
  53. package/lib-es2015/create/schema/parsers/enum.js.map +1 -1
  54. package/lib-es2015/create/schema/parsers/intersection.js +1 -3
  55. package/lib-es2015/create/schema/parsers/intersection.js.map +1 -1
  56. package/lib-es2015/create/schema/parsers/lazy.js.map +1 -1
  57. package/lib-es2015/create/schema/parsers/literal.js.map +1 -1
  58. package/lib-es2015/create/schema/parsers/nativeEnum.js.map +1 -1
  59. package/lib-es2015/create/schema/parsers/nullable.js +3 -1
  60. package/lib-es2015/create/schema/parsers/nullable.js.map +1 -1
  61. package/lib-es2015/create/schema/parsers/number.js +1 -2
  62. package/lib-es2015/create/schema/parsers/number.js.map +1 -1
  63. package/lib-es2015/create/schema/parsers/object.js +1 -1
  64. package/lib-es2015/create/schema/parsers/object.js.map +1 -1
  65. package/lib-es2015/create/schema/parsers/optional.js.map +1 -1
  66. package/lib-es2015/create/schema/parsers/pipeline.js +4 -12
  67. package/lib-es2015/create/schema/parsers/pipeline.js.map +1 -1
  68. package/lib-es2015/create/schema/parsers/preprocess.js +1 -3
  69. package/lib-es2015/create/schema/parsers/preprocess.js.map +1 -1
  70. package/lib-es2015/create/schema/parsers/readonly.js +1 -3
  71. package/lib-es2015/create/schema/parsers/readonly.js.map +1 -1
  72. package/lib-es2015/create/schema/parsers/record.js +1 -2
  73. package/lib-es2015/create/schema/parsers/record.js.map +1 -1
  74. package/lib-es2015/create/schema/parsers/refine.js +1 -3
  75. package/lib-es2015/create/schema/parsers/refine.js.map +1 -1
  76. package/lib-es2015/create/schema/parsers/set.js.map +1 -1
  77. package/lib-es2015/create/schema/parsers/string.js +64 -15
  78. package/lib-es2015/create/schema/parsers/string.js.map +1 -1
  79. package/lib-es2015/create/schema/parsers/transform.js.map +1 -1
  80. package/lib-es2015/create/schema/parsers/tuple.js.map +1 -1
  81. package/lib-es2015/create/schema/parsers/union.js +1 -2
  82. package/lib-es2015/create/schema/parsers/union.js.map +1 -1
  83. package/lib-es2015/extendZod.js +4 -4
  84. package/lib-es2015/extendZod.js.map +1 -1
  85. package/lib-es2015/zodType.js.map +1 -1
  86. package/lib-types/create/document.d.ts +6 -16
  87. package/lib-types/create/parameters.d.ts +2 -2
  88. package/lib-types/create/schema/index.d.ts +5 -5
  89. package/lib-types/create/schema/parsers/array.d.ts +2 -2
  90. package/lib-types/create/schema/parsers/brand.d.ts +2 -2
  91. package/lib-types/create/schema/parsers/catch.d.ts +2 -2
  92. package/lib-types/create/schema/parsers/default.d.ts +2 -2
  93. package/lib-types/create/schema/parsers/discriminatedUnion.d.ts +3 -3
  94. package/lib-types/create/schema/parsers/enum.d.ts +1 -1
  95. package/lib-types/create/schema/parsers/index.d.ts +1 -1
  96. package/lib-types/create/schema/parsers/intersection.d.ts +2 -2
  97. package/lib-types/create/schema/parsers/lazy.d.ts +2 -2
  98. package/lib-types/create/schema/parsers/literal.d.ts +1 -1
  99. package/lib-types/create/schema/parsers/manual.d.ts +1 -1
  100. package/lib-types/create/schema/parsers/nativeEnum.d.ts +2 -2
  101. package/lib-types/create/schema/parsers/nullable.d.ts +2 -2
  102. package/lib-types/create/schema/parsers/number.d.ts +0 -1
  103. package/lib-types/create/schema/parsers/object.d.ts +3 -3
  104. package/lib-types/create/schema/parsers/optional.d.ts +1 -1
  105. package/lib-types/create/schema/parsers/pipeline.d.ts +2 -2
  106. package/lib-types/create/schema/parsers/preprocess.d.ts +2 -2
  107. package/lib-types/create/schema/parsers/readonly.d.ts +2 -2
  108. package/lib-types/create/schema/parsers/record.d.ts +2 -2
  109. package/lib-types/create/schema/parsers/refine.d.ts +2 -2
  110. package/lib-types/create/schema/parsers/set.d.ts +2 -2
  111. package/lib-types/create/schema/parsers/transform.d.ts +2 -2
  112. package/lib-types/create/schema/parsers/tuple.d.ts +2 -2
  113. package/lib-types/create/schema/parsers/union.d.ts +2 -2
  114. package/lib-types/extendZod.d.ts +3 -5
  115. package/lib-types/zodType.d.ts +22 -22
  116. package/package.json +3 -3
@@ -10,13 +10,13 @@ export interface SchemaState {
10
10
  visited: Set<ZodType>;
11
11
  }
12
12
  export declare const newSchemaState: (state: SchemaState) => SchemaState;
13
- export declare const createNewSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, newState: SchemaState, subpath: string[]) => Schema;
14
- export declare const createNewRef: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(ref: string, zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => Schema;
15
- export declare const createExistingRef: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, component: SchemaComponent | undefined, state: SchemaState, subpath: string[]) => Schema | undefined;
13
+ export declare const createNewSchema: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, newState: SchemaState, subpath: string[]) => Schema;
14
+ export declare const createNewRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(ref: string, zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => Schema;
15
+ export declare const createExistingRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, component: SchemaComponent | undefined, state: SchemaState, subpath: string[]) => Schema | undefined;
16
16
  type Schema = {
17
17
  schema: oas31.ReferenceObject | oas31.SchemaObject;
18
18
  newState: SchemaState;
19
19
  };
20
- export declare const createSchemaOrRef: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => Schema;
21
- export declare const createSchemaObject: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => oas31.ReferenceObject | oas31.SchemaObject;
20
+ export declare const createSchemaOrRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => Schema;
21
+ export declare const createSchemaObject: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => oas31.ReferenceObject | oas31.SchemaObject;
22
22
  export {};
@@ -1,4 +1,4 @@
1
- import type { ZodArray } from 'zod';
1
+ import type { ArrayCardinality, ZodArray, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createArraySchema: (zodArray: ZodArray<any, any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createArraySchema: <T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many">(zodArray: ZodArray<T, Cardinality>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import type { ZodBranded } from 'zod';
1
+ import type { ZodBranded, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createBrandedSchema: (zodBranded: ZodBranded<any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createBrandedSchema: <T extends ZodTypeAny, B extends string | number | symbol>(zodBranded: ZodBranded<T, B>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodCatch } from 'zod';
1
+ import type { ZodCatch, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createCatchSchema: (zodCatch: ZodCatch<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createCatchSchema: <T extends ZodTypeAny>(zodCatch: ZodCatch<T>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodDefault } from 'zod';
1
+ import type { ZodDefault, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createDefaultSchema: (zodDefault: ZodDefault<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createDefaultSchema: <T extends ZodTypeAny>(zodDefault: ZodDefault<T>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,5 +1,5 @@
1
- import type { AnyZodObject, ZodDiscriminatedUnion } from 'zod';
1
+ import type { AnyZodObject, ZodDiscriminatedUnion, ZodDiscriminatedUnionOption } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createDiscriminatedUnionSchema: (zodDiscriminatedUnion: ZodDiscriminatedUnion<any, any>, state: SchemaState) => oas31.SchemaObject;
5
- export declare const mapDiscriminator: (schemas: (oas31.SchemaObject | oas31.ReferenceObject)[], zodObjects: AnyZodObject[], discriminator: unknown, state: SchemaState) => oas31.SchemaObject['discriminator'];
4
+ export declare const createDiscriminatedUnionSchema: <Discriminator extends string, Options extends ZodDiscriminatedUnionOption<Discriminator>[]>(zodDiscriminatedUnion: ZodDiscriminatedUnion<Discriminator, Options>, state: SchemaState) => oas31.SchemaObject;
5
+ export declare const mapDiscriminator: (schemas: Array<oas31.SchemaObject | oas31.ReferenceObject>, zodObjects: AnyZodObject[], discriminator: unknown, state: SchemaState) => oas31.SchemaObject['discriminator'];
@@ -1,3 +1,3 @@
1
1
  import type { ZodEnum } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
- export declare const createEnumSchema: (zodEnum: ZodEnum<any>) => oas31.SchemaObject;
3
+ export declare const createEnumSchema: <T extends [string, ...string[]]>(zodEnum: ZodEnum<T>) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
1
  import type { ZodType, ZodTypeDef } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import type { SchemaState } from '../../schema';
4
- export declare const createSchemaSwitch: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createSchemaSwitch: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodIntersection } from 'zod';
1
+ import type { ZodIntersection, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createIntersectionSchema: (zodIntersection: ZodIntersection<any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createIntersectionSchema: <T extends ZodTypeAny, U extends ZodTypeAny>(zodIntersection: ZodIntersection<T, U>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodLazy } from 'zod';
1
+ import type { ZodLazy, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createLazySchema: (zodLazy: ZodLazy<any>, state: SchemaState) => oas31.ReferenceObject | oas31.SchemaObject;
4
+ export declare const createLazySchema: <T extends ZodTypeAny>(zodLazy: ZodLazy<T>, state: SchemaState) => oas31.ReferenceObject | oas31.SchemaObject;
@@ -1,3 +1,3 @@
1
1
  import type { ZodLiteral } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
- export declare const createLiteralSchema: (zodLiteral: ZodLiteral<any>) => oas31.SchemaObject;
3
+ export declare const createLiteralSchema: (zodLiteral: ZodLiteral<unknown>) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
1
  import type { ZodType, ZodTypeDef } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import type { SchemaState } from '../../schema';
4
- export declare const createManualTypeSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createManualTypeSchema: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject;
@@ -6,6 +6,6 @@ interface StringsAndNumbers {
6
6
  strings: string[];
7
7
  numbers: number[];
8
8
  }
9
- export declare const getValidEnumValues: (enumValues: EnumLike) => (string | number)[];
10
- export declare const sortStringsAndNumbers: (values: (string | number)[]) => StringsAndNumbers;
9
+ export declare const getValidEnumValues: (enumValues: EnumLike) => number[];
10
+ export declare const sortStringsAndNumbers: (values: Array<string | number>) => StringsAndNumbers;
11
11
  export {};
@@ -1,4 +1,4 @@
1
- import type { ZodNullable } from 'zod';
1
+ import type { ZodNullable, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createNullableSchema: (zodNullable: ZodNullable<any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createNullableSchema: <T extends ZodTypeAny>(zodNullable: ZodNullable<T>, state: SchemaState) => oas31.SchemaObject;
@@ -3,7 +3,6 @@ import type { oas30, oas31 } from '../../../openapi3-ts/dist';
3
3
  import type { ZodOpenApiVersion } from '../../document';
4
4
  import type { SchemaState } from '../../schema';
5
5
  export declare const createNumberSchema: (zodNumber: ZodNumber, state: SchemaState) => oas31.SchemaObject;
6
- export declare const mapNumberChecks: () => void;
7
6
  export declare const mapMaximum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'maximum' | 'exclusiveMaximum'> | undefined;
8
7
  export declare const mapMinimum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'minimum' | 'exclusiveMinimum'> | undefined;
9
8
  type ZodNumberCheckMap = {
@@ -1,8 +1,8 @@
1
- import type { UnknownKeysParam, ZodObject, ZodRawShape, ZodType } from 'zod';
1
+ import type { UnknownKeysParam, ZodObject, ZodRawShape, ZodType, ZodTypeAny, objectInputType, objectOutputType } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createObjectSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam>(zodObject: ZodObject<T, UnknownKeys, any, any, any>, state: SchemaState) => oas31.SchemaObject;
5
- export declare const createExtendedSchema: (zodObject: ZodObject<any, any, any, any, any>, baseZodObject: ZodObject<any, any, any, any, any> | undefined, state: SchemaState) => oas31.SchemaObject | undefined;
4
+ export declare const createObjectSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>>(zodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input>, state: SchemaState) => oas31.SchemaObject;
5
+ export declare const createExtendedSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>>(zodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input>, baseZodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input> | undefined, state: SchemaState) => oas31.SchemaObject | undefined;
6
6
  interface AdditionalPropertyOptions {
7
7
  unknownKeys?: UnknownKeysParam;
8
8
  catchAll: ZodType;
@@ -1,5 +1,5 @@
1
1
  import type { ZodOptional, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createOptionalSchema: (zodOptional: ZodOptional<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createOptionalSchema: <T extends ZodTypeAny>(zodOptional: ZodOptional<T>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
5
5
  export declare const isOptionalSchema: (zodSchema: ZodTypeAny, state: SchemaState) => boolean;
@@ -1,4 +1,4 @@
1
- import type { ZodPipeline } from 'zod';
1
+ import type { ZodPipeline, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createPipelineSchema: (zodPipeline: ZodPipeline<any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createPipelineSchema: <A extends ZodTypeAny, B extends ZodTypeAny>(zodPipeline: ZodPipeline<A, B>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodEffects } from 'zod';
1
+ import type { ZodEffects, ZodTypeAny, input, output } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createPreprocessSchema: (zodPreprocess: ZodEffects<any, any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createPreprocessSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodPreprocess: ZodEffects<T, Output, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodReadonly } from 'zod';
1
+ import type { ZodReadonly, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createReadonlySchema: (zodReadonly: ZodReadonly<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createReadonlySchema: <T extends ZodTypeAny>(zodReadonly: ZodReadonly<T>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodRecord } from 'zod';
1
+ import type { KeySchema, ZodRecord, ZodString, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createRecordSchema: (zodRecord: ZodRecord<any, any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createRecordSchema: <Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny>(zodRecord: ZodRecord<Key, Value>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import type { ZodEffects } from 'zod';
1
+ import type { ZodEffects, ZodTypeAny, input, output } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createRefineSchema: (zodRefine: ZodEffects<any, any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createRefineSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodRefine: ZodEffects<T, Output, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import type { ZodSet } from 'zod';
1
+ import type { ZodSet, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createSetSchema: (zodSet: ZodSet<any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createSetSchema: <Value extends ZodTypeAny = ZodTypeAny>(zodSet: ZodSet<Value>, state: SchemaState) => oas31.SchemaObject;
@@ -1,5 +1,5 @@
1
- import type { ZodEffects, ZodType } from 'zod';
1
+ import type { ZodEffects, ZodType, ZodTypeAny, input, output } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createTransformSchema: (zodTransform: ZodEffects<any, any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
4
+ export declare const createTransformSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodTransform: ZodEffects<T, Output, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
5
5
  export declare const throwTransformError: (zodType: ZodType, state: SchemaState) => never;
@@ -1,4 +1,4 @@
1
- import type { ZodTuple } from 'zod';
1
+ import type { ZodTuple, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createTupleSchema: (zodTuple: ZodTuple<any, any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createTupleSchema: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null>(zodTuple: ZodTuple<T, Rest>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import type { ZodUnion } from 'zod';
1
+ import type { ZodTypeAny, ZodUnion } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
- export declare const createUnionSchema: (zodUnion: ZodUnion<any>, state: SchemaState) => oas31.SchemaObject;
4
+ export declare const createUnionSchema: <T extends readonly [ZodTypeAny, ...ZodTypeAny[]]>(zodUnion: ZodUnion<T>, state: SchemaState) => oas31.SchemaObject;
@@ -20,11 +20,9 @@ interface ZodOpenApiMetadata<T extends ZodTypeAny, TInferred = z.input<T> | z.ou
20
20
  effectType?: CreationType;
21
21
  param?: Partial<oas31.ParameterObject> & {
22
22
  example?: TInferred;
23
- examples?: {
24
- [param: string]: (oas31.ExampleObject & {
25
- value: TInferred;
26
- }) | oas31.ReferenceObject;
27
- };
23
+ examples?: Record<string, (oas31.ExampleObject & {
24
+ value: TInferred;
25
+ }) | oas31.ReferenceObject>;
28
26
  /**
29
27
  * Use this field to output this Zod Schema in the components parameters section. Any usage of this Zod Schema will then be transformed into a $ref.
30
28
  */
@@ -1,42 +1,42 @@
1
- import type { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeDef, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod';
2
- type ZodTypeMap = {
1
+ import type { ArrayCardinality, EnumLike, UnknownKeysParam, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodDiscriminatedUnionOption, ZodEffects, ZodEnum, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodTypeDef, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, objectInputType, objectOutputType } from 'zod';
2
+ type ZodTypeMap<T extends ZodTypeAny, U extends ZodTypeAny, V, W extends ZodRawShape, B extends string | number | symbol, Discriminator extends string, Options extends Array<ZodDiscriminatedUnionOption<Discriminator>>, Enum extends [string, ...string[]], Returns extends ZodTypeAny, Args extends ZodTuple, ELike extends EnumLike, Union extends readonly [ZodTypeAny, ...ZodTypeAny[]], UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<W, Catchall, UnknownKeys>, Input = objectInputType<W, Catchall, UnknownKeys>, Cardinality extends ArrayCardinality = 'many'> = {
3
3
  ZodAny: ZodAny;
4
- ZodArray: ZodArray<any>;
4
+ ZodArray: ZodArray<T, Cardinality>;
5
5
  ZodBigInt: ZodBigInt;
6
6
  ZodBoolean: ZodBoolean;
7
- ZodBranded: ZodBranded<any, any>;
8
- ZodCatch: ZodCatch<any>;
7
+ ZodBranded: ZodBranded<T, B>;
8
+ ZodCatch: ZodCatch<T>;
9
9
  ZodDate: ZodDate;
10
- ZodDefault: ZodDefault<any>;
11
- ZodDiscriminatedUnion: ZodDiscriminatedUnion<any, any>;
12
- ZodEffects: ZodEffects<any>;
13
- ZodEnum: ZodEnum<any>;
14
- ZodFunction: ZodFunction<any, any>;
15
- ZodIntersection: ZodIntersection<any, any>;
16
- ZodLazy: ZodLazy<any>;
17
- ZodLiteral: ZodLiteral<any>;
10
+ ZodDefault: ZodDefault<T>;
11
+ ZodDiscriminatedUnion: ZodDiscriminatedUnion<Discriminator, Options>;
12
+ ZodEffects: ZodEffects<T>;
13
+ ZodEnum: ZodEnum<Enum>;
14
+ ZodFunction: ZodFunction<Args, Returns>;
15
+ ZodIntersection: ZodIntersection<T, U>;
16
+ ZodLazy: ZodLazy<T>;
17
+ ZodLiteral: ZodLiteral<V>;
18
18
  ZodMap: ZodMap;
19
19
  ZodNaN: ZodNaN;
20
- ZodNativeEnum: ZodNativeEnum<any>;
20
+ ZodNativeEnum: ZodNativeEnum<ELike>;
21
21
  ZodNever: ZodNever;
22
22
  ZodNull: ZodNull;
23
- ZodNullable: ZodNullable<any>;
23
+ ZodNullable: ZodNullable<T>;
24
24
  ZodNumber: ZodNumber;
25
- ZodObject: ZodObject<any>;
26
- ZodOptional: ZodOptional<any>;
27
- ZodPipeline: ZodPipeline<any, any>;
28
- ZodPromise: ZodPromise<any>;
29
- ZodReadonly: ZodReadonly<any>;
25
+ ZodObject: ZodObject<W, UnknownKeys, Catchall, Output, Input>;
26
+ ZodOptional: ZodOptional<T>;
27
+ ZodPipeline: ZodPipeline<T, U>;
28
+ ZodPromise: ZodPromise<T>;
29
+ ZodReadonly: ZodReadonly<T>;
30
30
  ZodRecord: ZodRecord;
31
31
  ZodSet: ZodSet;
32
32
  ZodString: ZodString;
33
33
  ZodSymbol: ZodSymbol;
34
34
  ZodTuple: ZodTuple;
35
35
  ZodUndefined: ZodUndefined;
36
- ZodUnion: ZodUnion<any>;
36
+ ZodUnion: ZodUnion<Union>;
37
37
  ZodUnknown: ZodUnknown;
38
38
  ZodVoid: ZodVoid;
39
39
  };
40
- export declare const isZodType: <U extends keyof ZodTypeMap>(zodType: unknown, typeName: U) => zodType is ZodTypeMap[U];
40
+ export declare const isZodType: <T extends ZodTypeAny, U extends ZodTypeAny, V, W extends ZodRawShape, B extends string | number | symbol, Discriminator extends string, Options extends ZodDiscriminatedUnionOption<Discriminator>[], Enum extends [string, ...string[]], Returns extends ZodTypeAny, Args extends ZodTuple<[ZodTypeAny, ...ZodTypeAny[]], null>, ELike extends EnumLike, Union extends readonly [ZodTypeAny, ...ZodTypeAny[]], K extends keyof ZodTypeMap<T, U, V, W, B, Discriminator, Options, Enum, Returns, Args, ELike, Union, UnknownKeys, Catchall, Output, Input, Cardinality>, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<W, Catchall, UnknownKeys>, Input = objectInputType<W, Catchall, UnknownKeys>, Cardinality extends ArrayCardinality = "many">(zodType: unknown, typeName: K) => zodType is ZodTypeMap<T, U, V, W, B, Discriminator, Options, Enum, Returns, Args, ELike, Union, UnknownKeys, Catchall, Output, Input, Cardinality>[K];
41
41
  export declare const isAnyZodType: (zodType: unknown) => zodType is ZodType<any, ZodTypeDef, any>;
42
42
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",
@@ -47,9 +47,9 @@
47
47
  "@types/node": "^20.3.0",
48
48
  "eslint-plugin-zod-openapi": "^0.1.0",
49
49
  "openapi3-ts": "4.1.2",
50
- "skuba": "7.0.1",
50
+ "skuba": "7.1.1",
51
51
  "yaml": "2.3.1",
52
- "zod": "3.22.0"
52
+ "zod": "3.22.2"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "zod": "^3.21.4"