zod-openapi 2.7.2 → 2.7.4

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 (56) hide show
  1. package/lib-commonjs/create/components.js +7 -7
  2. package/lib-commonjs/create/components.js.map +1 -1
  3. package/lib-commonjs/create/content.js +2 -2
  4. package/lib-commonjs/create/content.js.map +1 -1
  5. package/lib-commonjs/create/parameters.js +2 -2
  6. package/lib-commonjs/create/parameters.js.map +1 -1
  7. package/lib-commonjs/create/responses.js +2 -2
  8. package/lib-commonjs/create/responses.js.map +1 -1
  9. package/lib-commonjs/create/schema/index.js +16 -8
  10. package/lib-commonjs/create/schema/index.js.map +1 -1
  11. package/lib-commonjs/create/schema/parsers/discriminatedUnion.js +2 -2
  12. package/lib-commonjs/create/schema/parsers/discriminatedUnion.js.map +1 -1
  13. package/lib-commonjs/create/schema/parsers/index.js +29 -29
  14. package/lib-commonjs/create/schema/parsers/index.js.map +1 -1
  15. package/lib-commonjs/create/schema/parsers/manual.js +2 -2
  16. package/lib-commonjs/create/schema/parsers/manual.js.map +1 -1
  17. package/lib-commonjs/create/schema/parsers/object.js +3 -3
  18. package/lib-commonjs/create/schema/parsers/object.js.map +1 -1
  19. package/lib-commonjs/create/schema/parsers/optional.js +10 -9
  20. package/lib-commonjs/create/schema/parsers/optional.js.map +1 -1
  21. package/lib-commonjs/zodType.js +9 -0
  22. package/lib-commonjs/zodType.js.map +1 -0
  23. package/lib-es2015/create/components.js +7 -7
  24. package/lib-es2015/create/components.js.map +1 -1
  25. package/lib-es2015/create/content.js +2 -2
  26. package/lib-es2015/create/content.js.map +1 -1
  27. package/lib-es2015/create/parameters.js +2 -2
  28. package/lib-es2015/create/parameters.js.map +1 -1
  29. package/lib-es2015/create/responses.js +2 -2
  30. package/lib-es2015/create/responses.js.map +1 -1
  31. package/lib-es2015/create/schema/index.js +16 -8
  32. package/lib-es2015/create/schema/index.js.map +1 -1
  33. package/lib-es2015/create/schema/parsers/discriminatedUnion.js +2 -2
  34. package/lib-es2015/create/schema/parsers/discriminatedUnion.js.map +1 -1
  35. package/lib-es2015/create/schema/parsers/index.js +29 -29
  36. package/lib-es2015/create/schema/parsers/index.js.map +1 -1
  37. package/lib-es2015/create/schema/parsers/manual.js +2 -2
  38. package/lib-es2015/create/schema/parsers/manual.js.map +1 -1
  39. package/lib-es2015/create/schema/parsers/object.js +3 -3
  40. package/lib-es2015/create/schema/parsers/object.js.map +1 -1
  41. package/lib-es2015/create/schema/parsers/optional.js +10 -9
  42. package/lib-es2015/create/schema/parsers/optional.js.map +1 -1
  43. package/lib-es2015/zodType.js +4 -0
  44. package/lib-es2015/zodType.js.map +1 -0
  45. package/lib-types/create/components.d.ts +1 -1
  46. package/lib-types/create/content.d.ts +1 -1
  47. package/lib-types/create/parameters.d.ts +1 -1
  48. package/lib-types/create/responses.d.ts +1 -1
  49. package/lib-types/create/schema/index.d.ts +1 -1
  50. package/lib-types/create/schema/parsers/discriminatedUnion.d.ts +1 -1
  51. package/lib-types/create/schema/parsers/index.d.ts +1 -1
  52. package/lib-types/create/schema/parsers/manual.d.ts +1 -1
  53. package/lib-types/create/schema/parsers/object.d.ts +1 -1
  54. package/lib-types/create/schema/parsers/optional.d.ts +1 -1
  55. package/lib-types/zodType.d.ts +41 -0
  56. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { ZodType } from 'zod';
1
+ import type { ZodType } from 'zod';
2
2
  import type { oas31 } from '../openapi3-ts/dist';
3
3
  import type { ComponentsObject, CreationType } from './components';
4
4
  import type { ZodOpenApiContentObject } from './document';
@@ -1,4 +1,4 @@
1
- import { ZodType } from 'zod';
1
+ import type { ZodType } from 'zod';
2
2
  import type { oas30, oas31 } from '../openapi3-ts/dist';
3
3
  import type { ComponentsObject } from './components';
4
4
  import type { ZodOpenApiParameters } from './document';
@@ -1,4 +1,4 @@
1
- import { type AnyZodObject, ZodType } from 'zod';
1
+ import type { AnyZodObject, ZodType } from 'zod';
2
2
  import type { oas30, oas31 } from '../openapi3-ts/dist';
3
3
  import { type ComponentsObject } from './components';
4
4
  import type { ZodOpenApiResponseObject, ZodOpenApiResponsesObject } from './document';
@@ -12,7 +12,7 @@ export interface SchemaState {
12
12
  export declare const newSchemaState: (state: SchemaState) => SchemaState;
13
13
  export declare const createNewSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, newState: SchemaState, subpath: string[]) => Schema;
14
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: (component: SchemaComponent | undefined, state: SchemaState, subpath: string[]) => Schema | undefined;
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;
16
16
  type Schema = {
17
17
  schema: oas31.ReferenceObject | oas31.SchemaObject;
18
18
  newState: SchemaState;
@@ -1,4 +1,4 @@
1
- import { type AnyZodObject, type ZodDiscriminatedUnion } from 'zod';
1
+ import type { AnyZodObject, ZodDiscriminatedUnion } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
4
  export declare const createDiscriminatedUnionSchema: (zodDiscriminatedUnion: ZodDiscriminatedUnion<any, any>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import { type ZodType, type ZodTypeDef } from 'zod';
1
+ import type { ZodType, ZodTypeDef } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import type { SchemaState } from '../../schema';
4
4
  export declare const createSchemaSwitch: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,4 +1,4 @@
1
- import { type ZodType, type ZodTypeDef } from 'zod';
1
+ import type { ZodType, ZodTypeDef } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import type { SchemaState } from '../../schema';
4
4
  export declare const createManualTypeSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import { type UnknownKeysParam, type ZodObject, type ZodRawShape, type ZodType } from 'zod';
1
+ import type { UnknownKeysParam, ZodObject, ZodRawShape, ZodType } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
4
  export declare const createObjectSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam>(zodObject: ZodObject<T, UnknownKeys, any, any, any>, state: SchemaState) => oas31.SchemaObject;
@@ -1,4 +1,4 @@
1
- import { ZodOptional, type ZodTypeAny } from 'zod';
1
+ import type { ZodOptional, ZodTypeAny } from 'zod';
2
2
  import type { oas31 } from '../../../openapi3-ts/dist';
3
3
  import { type SchemaState } from '../../schema';
4
4
  export declare const createOptionalSchema: (zodOptional: ZodOptional<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -0,0 +1,41 @@
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, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeDef, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod';
2
+ type ZodTypeMap = {
3
+ ZodAny: ZodAny;
4
+ ZodArray: ZodArray<any>;
5
+ ZodBigInt: ZodBigInt;
6
+ ZodBoolean: ZodBoolean;
7
+ ZodBranded: ZodBranded<any, any>;
8
+ ZodCatch: ZodCatch<any>;
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>;
18
+ ZodMap: ZodMap;
19
+ ZodNaN: ZodNaN;
20
+ ZodNativeEnum: ZodNativeEnum<any>;
21
+ ZodNever: ZodNever;
22
+ ZodNull: ZodNull;
23
+ ZodNullable: ZodNullable<any>;
24
+ ZodNumber: ZodNumber;
25
+ ZodObject: ZodObject<any>;
26
+ ZodOptional: ZodOptional<any>;
27
+ ZodPipeline: ZodPipeline<any, any>;
28
+ ZodPromise: ZodPromise<any>;
29
+ ZodRecord: ZodRecord;
30
+ ZodSet: ZodSet;
31
+ ZodString: ZodString;
32
+ ZodSymbol: ZodSymbol;
33
+ ZodTuple: ZodTuple;
34
+ ZodUndefined: ZodUndefined;
35
+ ZodUnion: ZodUnion<any>;
36
+ ZodUnknown: ZodUnknown;
37
+ ZodVoid: ZodVoid;
38
+ };
39
+ export declare const isZodType: <U extends keyof ZodTypeMap>(zodType: unknown, typeName: U) => zodType is ZodTypeMap[U];
40
+ export declare const isAnyZodType: (zodType: unknown) => zodType is ZodType<any, ZodTypeDef, any>;
41
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",