zod-openapi 0.4.3 → 0.5.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.
- package/README.md +25 -15
- package/lib-commonjs/create/components.js +6 -1
- package/lib-commonjs/create/components.js.map +1 -1
- package/lib-commonjs/create/content.js +9 -6
- package/lib-commonjs/create/content.js.map +1 -1
- package/lib-commonjs/create/parameters.js +4 -1
- package/lib-commonjs/create/parameters.js.map +1 -1
- package/lib-commonjs/create/paths.js +1 -1
- package/lib-commonjs/create/paths.js.map +1 -1
- package/lib-commonjs/create/responses.js +5 -2
- package/lib-commonjs/create/responses.js.map +1 -1
- package/lib-commonjs/create/schema/array.js +2 -2
- package/lib-commonjs/create/schema/array.js.map +1 -1
- package/lib-commonjs/create/schema/catch.js +7 -0
- package/lib-commonjs/create/schema/catch.js.map +1 -0
- package/lib-commonjs/create/schema/default.js +2 -2
- package/lib-commonjs/create/schema/default.js.map +1 -1
- package/lib-commonjs/create/schema/discriminatedUnion.js +2 -2
- package/lib-commonjs/create/schema/discriminatedUnion.js.map +1 -1
- package/lib-commonjs/create/schema/index.js +54 -28
- package/lib-commonjs/create/schema/index.js.map +1 -1
- package/lib-commonjs/create/schema/intersection.js +3 -3
- package/lib-commonjs/create/schema/intersection.js.map +1 -1
- package/lib-commonjs/create/schema/metadata.js +3 -3
- package/lib-commonjs/create/schema/metadata.js.map +1 -1
- package/lib-commonjs/create/schema/nativeEnum.js +2 -2
- package/lib-commonjs/create/schema/nativeEnum.js.map +1 -1
- package/lib-commonjs/create/schema/nullable.js +6 -6
- package/lib-commonjs/create/schema/nullable.js.map +1 -1
- package/lib-commonjs/create/schema/number.js +3 -3
- package/lib-commonjs/create/schema/number.js.map +1 -1
- package/lib-commonjs/create/schema/object.js +9 -9
- package/lib-commonjs/create/schema/object.js.map +1 -1
- package/lib-commonjs/create/schema/optional.js +2 -2
- package/lib-commonjs/create/schema/optional.js.map +1 -1
- package/lib-commonjs/create/schema/pipeline.js +12 -0
- package/lib-commonjs/create/schema/pipeline.js.map +1 -0
- package/lib-commonjs/create/schema/preprocess.js +14 -0
- package/lib-commonjs/create/schema/preprocess.js.map +1 -0
- package/lib-commonjs/create/schema/record.js +2 -2
- package/lib-commonjs/create/schema/record.js.map +1 -1
- package/lib-commonjs/create/schema/refine.js +7 -0
- package/lib-commonjs/create/schema/refine.js.map +1 -0
- package/lib-commonjs/create/schema/transform.js +14 -0
- package/lib-commonjs/create/schema/transform.js.map +1 -0
- package/lib-commonjs/create/schema/tuple.js +11 -9
- package/lib-commonjs/create/schema/tuple.js.map +1 -1
- package/lib-commonjs/create/schema/union.js +2 -2
- package/lib-commonjs/create/schema/union.js.map +1 -1
- package/lib-commonjs/create/schema/unknown.js +18 -0
- package/lib-commonjs/create/schema/unknown.js.map +1 -0
- package/lib-commonjs/extendZod.js.map +1 -1
- package/lib-es2015/create/components.js +6 -1
- package/lib-es2015/create/components.js.map +1 -1
- package/lib-es2015/create/content.js +9 -6
- package/lib-es2015/create/content.js.map +1 -1
- package/lib-es2015/create/parameters.js +4 -1
- package/lib-es2015/create/parameters.js.map +1 -1
- package/lib-es2015/create/paths.js +1 -1
- package/lib-es2015/create/paths.js.map +1 -1
- package/lib-es2015/create/responses.js +5 -2
- package/lib-es2015/create/responses.js.map +1 -1
- package/lib-es2015/create/schema/array.js +2 -2
- package/lib-es2015/create/schema/array.js.map +1 -1
- package/lib-es2015/create/schema/catch.js +3 -0
- package/lib-es2015/create/schema/catch.js.map +1 -0
- package/lib-es2015/create/schema/default.js +2 -2
- package/lib-es2015/create/schema/default.js.map +1 -1
- package/lib-es2015/create/schema/discriminatedUnion.js +2 -2
- package/lib-es2015/create/schema/discriminatedUnion.js.map +1 -1
- package/lib-es2015/create/schema/index.js +56 -30
- package/lib-es2015/create/schema/index.js.map +1 -1
- package/lib-es2015/create/schema/intersection.js +3 -3
- package/lib-es2015/create/schema/intersection.js.map +1 -1
- package/lib-es2015/create/schema/metadata.js +3 -3
- package/lib-es2015/create/schema/metadata.js.map +1 -1
- package/lib-es2015/create/schema/nativeEnum.js +2 -2
- package/lib-es2015/create/schema/nativeEnum.js.map +1 -1
- package/lib-es2015/create/schema/nullable.js +6 -6
- package/lib-es2015/create/schema/nullable.js.map +1 -1
- package/lib-es2015/create/schema/number.js +3 -3
- package/lib-es2015/create/schema/number.js.map +1 -1
- package/lib-es2015/create/schema/object.js +9 -9
- package/lib-es2015/create/schema/object.js.map +1 -1
- package/lib-es2015/create/schema/optional.js +2 -2
- package/lib-es2015/create/schema/optional.js.map +1 -1
- package/lib-es2015/create/schema/pipeline.js +8 -0
- package/lib-es2015/create/schema/pipeline.js.map +1 -0
- package/lib-es2015/create/schema/preprocess.js +10 -0
- package/lib-es2015/create/schema/preprocess.js.map +1 -0
- package/lib-es2015/create/schema/record.js +2 -2
- package/lib-es2015/create/schema/record.js.map +1 -1
- package/lib-es2015/create/schema/refine.js +3 -0
- package/lib-es2015/create/schema/refine.js.map +1 -0
- package/lib-es2015/create/schema/transform.js +10 -0
- package/lib-es2015/create/schema/transform.js.map +1 -0
- package/lib-es2015/create/schema/tuple.js +11 -9
- package/lib-es2015/create/schema/tuple.js.map +1 -1
- package/lib-es2015/create/schema/union.js +2 -2
- package/lib-es2015/create/schema/union.js.map +1 -1
- package/lib-es2015/create/schema/unknown.js +14 -0
- package/lib-es2015/create/schema/unknown.js.map +1 -0
- package/lib-es2015/extendZod.js.map +1 -1
- package/lib-types/create/components.d.ts +6 -4
- package/lib-types/create/content.d.ts +2 -2
- package/lib-types/create/schema/array.d.ts +2 -2
- package/lib-types/create/schema/catch.d.ts +4 -0
- package/lib-types/create/schema/default.d.ts +2 -2
- package/lib-types/create/schema/discriminatedUnion.d.ts +2 -2
- package/lib-types/create/schema/index.d.ts +9 -4
- package/lib-types/create/schema/intersection.d.ts +2 -2
- package/lib-types/create/schema/metadata.d.ts +2 -2
- package/lib-types/create/schema/nativeEnum.d.ts +2 -2
- package/lib-types/create/schema/nullable.d.ts +2 -2
- package/lib-types/create/schema/number.d.ts +2 -2
- package/lib-types/create/schema/object.d.ts +5 -5
- package/lib-types/create/schema/optional.d.ts +2 -2
- package/lib-types/create/schema/pipeline.d.ts +4 -0
- package/lib-types/create/schema/preprocess.d.ts +4 -0
- package/lib-types/create/schema/record.d.ts +2 -2
- package/lib-types/create/schema/refine.d.ts +4 -0
- package/lib-types/create/schema/transform.d.ts +4 -0
- package/lib-types/create/schema/tuple.d.ts +2 -2
- package/lib-types/create/schema/union.d.ts +2 -2
- package/lib-types/create/schema/unknown.d.ts +3 -0
- package/lib-types/extendZod.d.ts +14 -0
- package/package.json +1 -1
- package/lib-commonjs/create/schema/effects.js +0 -7
- package/lib-commonjs/create/schema/effects.js.map +0 -1
- package/lib-es2015/create/schema/effects.js +0 -3
- package/lib-es2015/create/schema/effects.js.map +0 -1
- package/lib-types/create/schema/effects.d.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extendZod.js","sourceRoot":"","sources":["../src/extendZod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extendZod.js","sourceRoot":"","sources":["../src/extendZod.ts"],"names":[],"mappings":"AA2EA,MAAM,UAAU,oBAAoB,CAAC,GAAa;IAChD,IAAI,OAAO,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,KAAK,WAAW,EAAE;QAC1D,OAAO;KACR;IACD,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,OAAO;QACjD,kJAAkJ;QAClJ,MAAM,MAAM,GAAG,IAAK,IAAY,CAAC,WAAW,CAAC;YAC3C,GAAG,IAAI,CAAC,IAAI;YACZ,OAAO;SACR,CAAC,CAAC;QAEH,+DAA+D;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,6DAA6D;IAC7D,MAAM,eAAe,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC;IAEvD,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,UAC/B,GAAG,IAAiC;QAEpC,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,YAAY,CAAC,IAAI,CAAC,cAAc,GAAG;YACjC,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG;SAC3C,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;QACjC,+DAA+D;QAC/D,OAAO,YAAmB,CAAC;IAC7B,CAAC,CAAC;IAEF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;IAEnD,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,UAC7B,GAAG,IAA+C;QAElD,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnD,OAAO,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;QACtC,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC/B,+DAA+D;QAC/D,OAAO,UAAiB,CAAC;IAC3B,CAAC,CAAC;IAEF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;IAEnD,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,UAC7B,GAAG,IAA+C;QAElD,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnD,OAAO,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;QACtC,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC/B,+DAA+D;QAC/D,OAAO,UAAiB,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { oas30, oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodType } from 'zod';
|
|
3
3
|
import { ZodOpenApiComponentsObject, ZodOpenApiVersion } from './document';
|
|
4
|
-
export
|
|
4
|
+
export type CreationType = 'input' | 'output';
|
|
5
|
+
export interface SchemaComponent {
|
|
5
6
|
zodSchema?: ZodType;
|
|
6
7
|
schemaObject: oas31.SchemaObject | oas31.ReferenceObject | oas30.SchemaObject | oas30.ReferenceObject;
|
|
8
|
+
types?: [CreationType, ...CreationType[]];
|
|
7
9
|
}
|
|
8
10
|
interface SchemaComponentObject {
|
|
9
|
-
[ref: string]:
|
|
11
|
+
[ref: string]: SchemaComponent | undefined;
|
|
10
12
|
}
|
|
11
|
-
export interface
|
|
13
|
+
export interface ParameterComponent {
|
|
12
14
|
zodSchema?: ZodType;
|
|
13
15
|
paramObject: oas31.ParameterObject | oas31.ReferenceObject | oas30.ParameterObject | oas30.ReferenceObject;
|
|
14
16
|
}
|
|
15
17
|
interface ParametersComponentObject {
|
|
16
|
-
[ref: string]:
|
|
18
|
+
[ref: string]: ParameterComponent | undefined;
|
|
17
19
|
}
|
|
18
20
|
export interface Header {
|
|
19
21
|
zodSchema?: ZodType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
|
-
import { ComponentsObject } from './components';
|
|
2
|
+
import { ComponentsObject, CreationType } from './components';
|
|
3
3
|
import { ZodOpenApiContentObject } from './document';
|
|
4
|
-
export declare const createContent: (contentObject: ZodOpenApiContentObject, components: ComponentsObject) => oas31.ContentObject;
|
|
4
|
+
export declare const createContent: (contentObject: ZodOpenApiContentObject, components: ComponentsObject, type: CreationType) => oas31.ContentObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodArray } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createArraySchema: (zodArray: ZodArray<any, any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createArraySchema: (zodArray: ZodArray<any, any>, state: SchemaState) => oas31.SchemaObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodDefault } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createDefaultSchema: (zodDefault: ZodDefault<any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createDefaultSchema: (zodDefault: ZodDefault<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { AnyZodObject, ZodDiscriminatedUnion } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createDiscriminatedUnionSchema: (zodDiscriminatedUnion: ZodDiscriminatedUnion<any, any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createDiscriminatedUnionSchema: (zodDiscriminatedUnion: ZodDiscriminatedUnion<any, any>, state: SchemaState) => oas31.SchemaObject;
|
|
5
5
|
export declare const mapDiscriminator: (zodObjects: AnyZodObject[], discriminator: string) => {
|
|
6
6
|
propertyName: string;
|
|
7
7
|
mapping: {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodType, ZodTypeDef } from 'zod';
|
|
3
|
-
import { ComponentsObject } from '../components';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { ComponentsObject, CreationType } from '../components';
|
|
4
|
+
export interface SchemaState {
|
|
5
|
+
components: ComponentsObject;
|
|
6
|
+
type: CreationType;
|
|
7
|
+
effectType?: CreationType;
|
|
8
|
+
}
|
|
9
|
+
export declare const createSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
10
|
+
export declare const createRegisteredSchema: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, schemaRef: string, state: SchemaState) => oas31.ReferenceObject;
|
|
11
|
+
export declare const createSchemaOrRef: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodIntersection } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createIntersectionSchema: (zodIntersection: ZodIntersection<any, any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createIntersectionSchema: (zodIntersection: ZodIntersection<any, any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodType, ZodTypeDef } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createSchemaWithMetadata: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createSchemaWithMetadata: <Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
5
5
|
export declare const enhanceWithMetadata: (schemaOrRef: oas31.SchemaObject | oas31.ReferenceObject, metadata: oas31.SchemaObject | oas31.ReferenceObject) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { EnumLike, ZodNativeEnum } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createNativeEnumSchema: <T extends EnumLike>(zodEnum: ZodNativeEnum<T>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createNativeEnumSchema: <T extends EnumLike>(zodEnum: ZodNativeEnum<T>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
5
5
|
interface StringsAndNumbers {
|
|
6
6
|
strings: string[];
|
|
7
7
|
numbers: number[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodNullable } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createNullableSchema: (zodNullable: ZodNullable<any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createNullableSchema: (zodNullable: ZodNullable<any>, state: SchemaState) => oas31.SchemaObject;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { oas30, oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodNumber, ZodNumberCheck } from 'zod';
|
|
3
|
-
import { ComponentsObject } from '../components';
|
|
4
3
|
import { ZodOpenApiVersion } from '../document';
|
|
5
|
-
|
|
4
|
+
import { SchemaState } from '.';
|
|
5
|
+
export declare const createNumberSchema: (zodNumber: ZodNumber, state: SchemaState) => oas31.SchemaObject;
|
|
6
6
|
export declare const mapNumberChecks: () => void;
|
|
7
7
|
export declare const mapMaximum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'maximum' | 'exclusiveMaximum'> | undefined;
|
|
8
8
|
export declare const mapMinimum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'minimum' | 'exclusiveMinimum'> | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { UnknownKeysParam, ZodObject, ZodRawShape } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createObjectSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam>(zodObject: ZodObject<T, UnknownKeys, any, any, any>,
|
|
5
|
-
export declare const createExtendedSchema: (zodObject: ZodObject<any, any, any, any, any>, baseZodObject: ZodObject<any, any, any, any, any>, schemaRef: string,
|
|
6
|
-
export declare const createObjectSchemaFromShape: (shape: ZodRawShape, strict: boolean,
|
|
3
|
+
import { SchemaState } from '.';
|
|
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>, schemaRef: string, state: SchemaState) => oas31.SchemaObject;
|
|
6
|
+
export declare const createObjectSchemaFromShape: (shape: ZodRawShape, strict: boolean, state: SchemaState) => oas31.SchemaObject;
|
|
7
7
|
export declare const mapRequired: (shape: ZodRawShape) => oas31.SchemaObject['required'];
|
|
8
|
-
export declare const mapProperties: (shape: ZodRawShape,
|
|
8
|
+
export declare const mapProperties: (shape: ZodRawShape, state: SchemaState) => oas31.SchemaObject['properties'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodOptional } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createOptionalSchema: (zodOptional: ZodOptional<any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createOptionalSchema: (zodOptional: ZodOptional<any>, state: SchemaState) => oas31.SchemaObject | oas31.ReferenceObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodRecord } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createRecordSchema: (zodRecord: ZodRecord<any, any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createRecordSchema: (zodRecord: ZodRecord<any, any>, state: SchemaState) => oas31.SchemaObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodTuple } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createTupleSchema: (zodTuple: ZodTuple<any, any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createTupleSchema: (zodTuple: ZodTuple<any, any>, state: SchemaState) => oas31.SchemaObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { oas31 } from 'openapi3-ts';
|
|
2
2
|
import { ZodUnion } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
export declare const createUnionSchema: (zodUnion: ZodUnion<any>,
|
|
3
|
+
import { SchemaState } from '.';
|
|
4
|
+
export declare const createUnionSchema: (zodUnion: ZodUnion<any>, state: SchemaState) => oas31.SchemaObject;
|
package/lib-types/extendZod.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { oas30, oas31 } from 'openapi3-ts';
|
|
2
2
|
import { UnknownKeysParam, ZodDate, ZodObject, ZodRawShape, ZodTypeAny, z } from 'zod';
|
|
3
|
+
import { CreationType } from './create/components';
|
|
3
4
|
type SchemaObject = oas30.SchemaObject & oas31.SchemaObject;
|
|
4
5
|
interface ZodOpenApiMetadata<T extends ZodTypeAny, TInferred = z.infer<T>> extends SchemaObject {
|
|
5
6
|
example?: TInferred;
|
|
6
7
|
examples?: [TInferred, ...TInferred[]];
|
|
7
8
|
default?: T extends ZodDate ? string : TInferred;
|
|
9
|
+
/**
|
|
10
|
+
* Use this field to output this Zod Schema in the components schemas section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
11
|
+
*/
|
|
8
12
|
ref?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Use this field when you are manually adding a Zod Schema to the components section. This controls whether this should be rendered as request (`input`) or response (`output`). Defaults to `output`
|
|
15
|
+
*/
|
|
16
|
+
refType?: CreationType;
|
|
9
17
|
param?: Partial<oas31.ParameterObject> & {
|
|
10
18
|
example?: TInferred;
|
|
11
19
|
examples?: {
|
|
@@ -13,9 +21,15 @@ interface ZodOpenApiMetadata<T extends ZodTypeAny, TInferred = z.infer<T>> exten
|
|
|
13
21
|
value: TInferred;
|
|
14
22
|
}) | oas31.ReferenceObject;
|
|
15
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* 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.
|
|
26
|
+
*/
|
|
16
27
|
ref?: string;
|
|
17
28
|
};
|
|
18
29
|
header?: Partial<oas31.HeaderObject & oas30.HeaderObject> & {
|
|
30
|
+
/**
|
|
31
|
+
* Use this field to output this Zod Schema in the components headers section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
32
|
+
*/
|
|
19
33
|
ref?: string;
|
|
20
34
|
};
|
|
21
35
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEffectsSchema = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
const createEffectsSchema = (zodEffects, components) => (0, _1.createSchemaOrRef)(zodEffects._def.schema, components);
|
|
6
|
-
exports.createEffectsSchema = createEffectsSchema;
|
|
7
|
-
//# sourceMappingURL=effects.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../../../src/create/schema/effects.ts"],"names":[],"mappings":";;;AAKA,wBAAsC;AAE/B,MAAM,mBAAmB,GAAG,CACjC,UAAqC,EACrC,UAA4B,EACgB,EAAE,CAC9C,IAAA,oBAAiB,EAAC,UAAU,CAAC,IAAI,CAAC,MAAiB,EAAE,UAAU,CAAC,CAAC;AAJtD,QAAA,mBAAmB,uBAImC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../../../src/create/schema/effects.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAAqC,EACrC,UAA4B,EACgB,EAAE,CAC9C,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAiB,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { oas31 } from 'openapi3-ts';
|
|
2
|
-
import { ZodEffects } from 'zod';
|
|
3
|
-
import { ComponentsObject } from '../components';
|
|
4
|
-
export declare const createEffectsSchema: (zodEffects: ZodEffects<any, any, any>, components: ComponentsObject) => oas31.SchemaObject | oas31.ReferenceObject;
|