zod-openapi 5.0.0-beta.3 → 5.0.0-beta.5
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 +207 -70
- package/dist/api.cjs +4 -4
- package/dist/api.d.mts +3 -5
- package/dist/api.d.ts +3 -5
- package/dist/api.mjs +5 -5
- package/dist/components.chunk.cjs +2304 -864
- package/dist/components.chunk.mjs +2294 -854
- package/dist/create/components.d.ts +121 -61
- package/dist/create/content.d.ts +6 -8
- package/dist/create/document.d.ts +32 -38
- package/dist/create/parameters.d.ts +7 -12
- package/dist/create/schema/single.d.ts +33 -0
- package/dist/extend.cjs +4 -0
- package/dist/extend.d.mts +1 -0
- package/dist/extend.d.ts +1 -0
- package/dist/extend.mjs +3 -0
- package/dist/extendZod.chunk.cjs +95 -0
- package/dist/extendZod.chunk.mjs +96 -0
- package/dist/extendZod.d.ts +6 -0
- package/dist/extendZodSymbols.chunk.cjs +5 -0
- package/dist/extendZodSymbols.chunk.mjs +6 -0
- package/dist/extendZodSymbols.d.ts +4 -0
- package/dist/extendZodTypes.d.ts +91 -0
- package/dist/index.cjs +55 -18
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.mjs +56 -20
- package/dist/openapi.d.ts +1 -1
- package/dist/openapi3-ts/dist/model/openapi30.d.ts +291 -0
- package/dist/openapi3-ts/dist/model/openapi31.d.ts +0 -4
- package/dist/openapi3-ts/dist/oas30.d.ts +3 -0
- package/dist/openapi3-ts/{oas31.d.ts → dist/oas31.d.ts} +3 -3
- package/extend/index.d.ts +1 -0
- package/extend/package.json +5 -0
- package/package.json +5 -5
- package/dist/create/object.d.ts +0 -5
- package/dist/create/schema/schema.d.ts +0 -21
- package/dist/zod.d.ts +0 -49
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ZodTypeAny, z, ZodObject } from 'zod';
|
|
2
|
+
import { CreationType } from './create/components.js';
|
|
3
|
+
import { currentSymbol, previousSymbol } from './extendZodSymbols.js';
|
|
4
|
+
import { SchemaObject as SchemaObject$1, HeaderObject as HeaderObject$1 } from './openapi3-ts/dist/model/openapi30.js';
|
|
5
|
+
import { SchemaObject as SchemaObject$2, ParameterObject, ExampleObject, ReferenceObject, HeaderObject } from './openapi3-ts/dist/model/openapi31.js';
|
|
6
|
+
|
|
7
|
+
type SchemaObject = SchemaObject$1 & SchemaObject$2;
|
|
8
|
+
type ReplaceDate<T> = T extends Date ? Date | string : T;
|
|
9
|
+
/**
|
|
10
|
+
* zod-openapi metadata
|
|
11
|
+
*/
|
|
12
|
+
interface ZodOpenApiMetadata<T extends ZodTypeAny, TInferred = Exclude<ReplaceDate<z.input<T> | z.output<T>>, undefined>> extends SchemaObject {
|
|
13
|
+
example?: TInferred;
|
|
14
|
+
examples?: [TInferred, ...TInferred[]];
|
|
15
|
+
default?: TInferred;
|
|
16
|
+
/**
|
|
17
|
+
* Used to set the output of a ZodUnion to be `oneOf` instead of `allOf`
|
|
18
|
+
*/
|
|
19
|
+
unionOneOf?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Used to output this Zod Schema in the components schemas section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
22
|
+
*/
|
|
23
|
+
ref?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Used when you are manually adding a Zod Schema to the components section. This controls whether this should be rendered as a request (`input`) or response (`output`). Defaults to `output`
|
|
26
|
+
*/
|
|
27
|
+
refType?: CreationType;
|
|
28
|
+
/**
|
|
29
|
+
* Used to set the created type of an effect.
|
|
30
|
+
* If this was previously set to `same` and this is throwing an error, your effect is no longer returning the same type.
|
|
31
|
+
*/
|
|
32
|
+
effectType?: CreationType | (z.input<T> extends z.output<T> ? z.output<T> extends z.input<T> ? 'same' : never : never);
|
|
33
|
+
/**
|
|
34
|
+
* Used to set metadata for a parameter, request header or cookie
|
|
35
|
+
*/
|
|
36
|
+
param?: Partial<ParameterObject> & {
|
|
37
|
+
example?: TInferred;
|
|
38
|
+
examples?: Record<string, (ExampleObject & {
|
|
39
|
+
value: TInferred;
|
|
40
|
+
}) | ReferenceObject>;
|
|
41
|
+
/**
|
|
42
|
+
* Used to output this Zod Schema in the components parameters section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
43
|
+
*/
|
|
44
|
+
ref?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Used to set data for a response header
|
|
48
|
+
*/
|
|
49
|
+
header?: Partial<HeaderObject & HeaderObject$1> & {
|
|
50
|
+
/**
|
|
51
|
+
* Used to output this Zod Schema in the components headers section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
52
|
+
*/
|
|
53
|
+
ref?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Used to override the generated type. If this is provided no metadata will be generated.
|
|
57
|
+
*/
|
|
58
|
+
type?: SchemaObject['type'];
|
|
59
|
+
}
|
|
60
|
+
interface ZodOpenApiMetadataDef {
|
|
61
|
+
/**
|
|
62
|
+
* Up to date OpenAPI metadata
|
|
63
|
+
*/
|
|
64
|
+
openapi?: ZodOpenApiMetadata<ZodTypeAny>;
|
|
65
|
+
/**
|
|
66
|
+
* Used to keep track of the Zod Schema had `.openapi` called on it
|
|
67
|
+
*/
|
|
68
|
+
[currentSymbol]?: ZodTypeAny;
|
|
69
|
+
/**
|
|
70
|
+
* Used to keep track of the previous Zod Schema that had `.openapi` called on it if another `.openapi` is called.
|
|
71
|
+
* This can also be present when .extend is called on an object.
|
|
72
|
+
*/
|
|
73
|
+
[previousSymbol]?: ZodTypeAny;
|
|
74
|
+
}
|
|
75
|
+
interface ZodOpenApiExtendMetadata {
|
|
76
|
+
extends: ZodObject<any, any, any, any, any>;
|
|
77
|
+
}
|
|
78
|
+
declare module 'zod' {
|
|
79
|
+
interface ZodType {
|
|
80
|
+
/**
|
|
81
|
+
* Add OpenAPI metadata to a Zod Type
|
|
82
|
+
*/
|
|
83
|
+
openapi<T extends ZodTypeAny>(this: T, metadata: ZodOpenApiMetadata<T>): T;
|
|
84
|
+
}
|
|
85
|
+
interface ZodTypeDef {
|
|
86
|
+
zodOpenApi?: ZodOpenApiMetadataDef;
|
|
87
|
+
}
|
|
88
|
+
interface ZodObjectDef {
|
|
89
|
+
extendMetadata?: ZodOpenApiExtendMetadata;
|
|
90
|
+
}
|
|
91
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,23 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const components = require("./components.chunk.cjs");
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const createdWebhooks = components.createPaths(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const extendZod = require("./extendZod.chunk.cjs");
|
|
5
|
+
const createDocument = (zodOpenApiObject, documentOptions) => {
|
|
6
|
+
const { paths, webhooks, components: components$1 = {}, ...rest } = zodOpenApiObject;
|
|
7
|
+
const defaultComponents = components.getDefaultComponents(
|
|
8
|
+
components$1,
|
|
9
|
+
zodOpenApiObject.openapi
|
|
10
|
+
);
|
|
11
|
+
const createdPaths = components.createPaths(paths, defaultComponents, documentOptions);
|
|
12
|
+
const createdWebhooks = components.createPaths(
|
|
13
|
+
webhooks,
|
|
14
|
+
defaultComponents,
|
|
15
|
+
documentOptions
|
|
16
|
+
);
|
|
17
|
+
const createdComponents = components.createComponents(
|
|
18
|
+
components$1,
|
|
19
|
+
defaultComponents,
|
|
20
|
+
documentOptions
|
|
21
|
+
);
|
|
22
|
+
return {
|
|
23
|
+
...rest,
|
|
24
|
+
...createdPaths && { paths: createdPaths },
|
|
25
|
+
...createdWebhooks && { webhooks: createdWebhooks },
|
|
26
|
+
...createdComponents && { components: createdComponents }
|
|
27
|
+
};
|
|
21
28
|
};
|
|
22
|
-
|
|
29
|
+
const createSchema = (zodType, opts) => {
|
|
30
|
+
const components$1 = components.getDefaultComponents(
|
|
31
|
+
{
|
|
32
|
+
schemas: opts == null ? void 0 : opts.components
|
|
33
|
+
},
|
|
34
|
+
opts == null ? void 0 : opts.openapi
|
|
35
|
+
);
|
|
36
|
+
const state = {
|
|
37
|
+
components: components$1,
|
|
38
|
+
type: (opts == null ? void 0 : opts.schemaType) ?? "output",
|
|
39
|
+
path: [],
|
|
40
|
+
visited: /* @__PURE__ */ new Set(),
|
|
41
|
+
documentOptions: opts
|
|
42
|
+
};
|
|
43
|
+
const schema = components.createSchema(zodType, state, ["createSchema"]);
|
|
44
|
+
const schemaComponents = components.createSchemaComponents({}, components$1);
|
|
45
|
+
return {
|
|
46
|
+
schema,
|
|
47
|
+
components: schemaComponents
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const oas30 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
|
+
__proto__: null
|
|
52
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
53
|
+
const oas31 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
54
|
+
__proto__: null
|
|
55
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
56
|
+
exports.extendZodWithOpenApi = extendZod.extendZodWithOpenApi;
|
|
23
57
|
exports.createDocument = createDocument;
|
|
58
|
+
exports.createSchema = createSchema;
|
|
59
|
+
exports.oas30 = oas30;
|
|
60
|
+
exports.oas31 = oas31;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { CreateDocumentOptions,
|
|
2
|
-
export { SchemaResult, createSchema } from './create/schema/
|
|
3
|
-
export {
|
|
4
|
-
import * as
|
|
1
|
+
export { CreateDocumentOptions, ZodObjectInputType, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiVersion, createDocument } from './create/document.js';
|
|
2
|
+
export { CreateSchemaOptions, SchemaResult, createSchema } from './create/schema/single.js';
|
|
3
|
+
export { extendZodWithOpenApi } from './extendZod.js';
|
|
4
|
+
import * as oas30 from './openapi3-ts/dist/oas30.js';
|
|
5
|
+
export { oas30 };
|
|
6
|
+
import * as oas31 from './openapi3-ts/dist/oas31.js';
|
|
5
7
|
export { oas31 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { CreateDocumentOptions,
|
|
2
|
-
export { SchemaResult, createSchema } from './create/schema/
|
|
3
|
-
export {
|
|
4
|
-
import * as
|
|
1
|
+
export { CreateDocumentOptions, ZodObjectInputType, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiVersion, createDocument } from './create/document.js';
|
|
2
|
+
export { CreateSchemaOptions, SchemaResult, createSchema } from './create/schema/single.js';
|
|
3
|
+
export { extendZodWithOpenApi } from './extendZod.js';
|
|
4
|
+
import * as oas30 from './openapi3-ts/dist/oas30.js';
|
|
5
|
+
export { oas30 };
|
|
6
|
+
import * as oas31 from './openapi3-ts/dist/oas31.js';
|
|
5
7
|
export { oas31 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const createDocument = (zodOpenApiObject,
|
|
4
|
-
const { paths, webhooks, components, ...rest } = zodOpenApiObject;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const createdComponents = createComponents(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { getDefaultComponents, createPaths, createComponents, createSchema as createSchema$1, createSchemaComponents } from "./components.chunk.mjs";
|
|
2
|
+
import { extendZodWithOpenApi } from "./extendZod.chunk.mjs";
|
|
3
|
+
const createDocument = (zodOpenApiObject, documentOptions) => {
|
|
4
|
+
const { paths, webhooks, components = {}, ...rest } = zodOpenApiObject;
|
|
5
|
+
const defaultComponents = getDefaultComponents(
|
|
6
|
+
components,
|
|
7
|
+
zodOpenApiObject.openapi
|
|
8
|
+
);
|
|
9
|
+
const createdPaths = createPaths(paths, defaultComponents, documentOptions);
|
|
10
|
+
const createdWebhooks = createPaths(
|
|
11
|
+
webhooks,
|
|
12
|
+
defaultComponents,
|
|
13
|
+
documentOptions
|
|
14
|
+
);
|
|
15
|
+
const createdComponents = createComponents(
|
|
16
|
+
components,
|
|
17
|
+
defaultComponents,
|
|
18
|
+
documentOptions
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
...rest,
|
|
22
|
+
...createdPaths && { paths: createdPaths },
|
|
23
|
+
...createdWebhooks && { webhooks: createdWebhooks },
|
|
24
|
+
...createdComponents && { components: createdComponents }
|
|
25
|
+
};
|
|
20
26
|
};
|
|
27
|
+
const createSchema = (zodType, opts) => {
|
|
28
|
+
const components = getDefaultComponents(
|
|
29
|
+
{
|
|
30
|
+
schemas: opts == null ? void 0 : opts.components
|
|
31
|
+
},
|
|
32
|
+
opts == null ? void 0 : opts.openapi
|
|
33
|
+
);
|
|
34
|
+
const state = {
|
|
35
|
+
components,
|
|
36
|
+
type: (opts == null ? void 0 : opts.schemaType) ?? "output",
|
|
37
|
+
path: [],
|
|
38
|
+
visited: /* @__PURE__ */ new Set(),
|
|
39
|
+
documentOptions: opts
|
|
40
|
+
};
|
|
41
|
+
const schema = createSchema$1(zodType, state, ["createSchema"]);
|
|
42
|
+
const schemaComponents = createSchemaComponents({}, components);
|
|
43
|
+
return {
|
|
44
|
+
schema,
|
|
45
|
+
components: schemaComponents
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const oas30 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
49
|
+
__proto__: null
|
|
50
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
51
|
+
const oas31 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
52
|
+
__proto__: null
|
|
53
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
21
54
|
export {
|
|
22
55
|
createDocument,
|
|
23
|
-
createSchema
|
|
56
|
+
createSchema,
|
|
57
|
+
extendZodWithOpenApi,
|
|
58
|
+
oas30,
|
|
59
|
+
oas31
|
|
24
60
|
};
|
package/dist/openapi.d.ts
CHANGED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { ServerObject } from './oas-common.js';
|
|
2
|
+
export { ServerVariableObject } from './oas-common.js';
|
|
3
|
+
import { ISpecificationExtension } from './specification-extension.js';
|
|
4
|
+
|
|
5
|
+
interface OpenAPIObject extends ISpecificationExtension {
|
|
6
|
+
openapi: string;
|
|
7
|
+
info: InfoObject;
|
|
8
|
+
servers?: ServerObject[];
|
|
9
|
+
paths: PathsObject;
|
|
10
|
+
components?: ComponentsObject;
|
|
11
|
+
security?: SecurityRequirementObject[];
|
|
12
|
+
tags?: TagObject[];
|
|
13
|
+
externalDocs?: ExternalDocumentationObject;
|
|
14
|
+
}
|
|
15
|
+
interface InfoObject extends ISpecificationExtension {
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
termsOfService?: string;
|
|
19
|
+
contact?: ContactObject;
|
|
20
|
+
license?: LicenseObject;
|
|
21
|
+
version: string;
|
|
22
|
+
}
|
|
23
|
+
interface ContactObject extends ISpecificationExtension {
|
|
24
|
+
name?: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
email?: string;
|
|
27
|
+
}
|
|
28
|
+
interface LicenseObject extends ISpecificationExtension {
|
|
29
|
+
name: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
}
|
|
32
|
+
interface ComponentsObject extends ISpecificationExtension {
|
|
33
|
+
schemas?: {
|
|
34
|
+
[schema: string]: SchemaObject | ReferenceObject;
|
|
35
|
+
};
|
|
36
|
+
responses?: {
|
|
37
|
+
[response: string]: ResponseObject | ReferenceObject;
|
|
38
|
+
};
|
|
39
|
+
parameters?: {
|
|
40
|
+
[parameter: string]: ParameterObject | ReferenceObject;
|
|
41
|
+
};
|
|
42
|
+
examples?: {
|
|
43
|
+
[example: string]: ExampleObject | ReferenceObject;
|
|
44
|
+
};
|
|
45
|
+
requestBodies?: {
|
|
46
|
+
[request: string]: RequestBodyObject | ReferenceObject;
|
|
47
|
+
};
|
|
48
|
+
headers?: {
|
|
49
|
+
[header: string]: HeaderObject | ReferenceObject;
|
|
50
|
+
};
|
|
51
|
+
securitySchemes?: {
|
|
52
|
+
[securityScheme: string]: SecuritySchemeObject | ReferenceObject;
|
|
53
|
+
};
|
|
54
|
+
links?: {
|
|
55
|
+
[link: string]: LinkObject | ReferenceObject;
|
|
56
|
+
};
|
|
57
|
+
callbacks?: {
|
|
58
|
+
[callback: string]: CallbackObject | ReferenceObject;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
interface PathsObject extends ISpecificationExtension {
|
|
62
|
+
[path: string]: PathItemObject;
|
|
63
|
+
}
|
|
64
|
+
type PathObject = PathsObject;
|
|
65
|
+
interface PathItemObject extends ISpecificationExtension {
|
|
66
|
+
$ref?: string;
|
|
67
|
+
summary?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
get?: OperationObject;
|
|
70
|
+
put?: OperationObject;
|
|
71
|
+
post?: OperationObject;
|
|
72
|
+
delete?: OperationObject;
|
|
73
|
+
options?: OperationObject;
|
|
74
|
+
head?: OperationObject;
|
|
75
|
+
patch?: OperationObject;
|
|
76
|
+
trace?: OperationObject;
|
|
77
|
+
servers?: ServerObject[];
|
|
78
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
79
|
+
}
|
|
80
|
+
interface OperationObject extends ISpecificationExtension {
|
|
81
|
+
tags?: string[];
|
|
82
|
+
summary?: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
externalDocs?: ExternalDocumentationObject;
|
|
85
|
+
operationId?: string;
|
|
86
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
87
|
+
requestBody?: RequestBodyObject | ReferenceObject;
|
|
88
|
+
responses: ResponsesObject;
|
|
89
|
+
callbacks?: CallbacksObject;
|
|
90
|
+
deprecated?: boolean;
|
|
91
|
+
security?: SecurityRequirementObject[];
|
|
92
|
+
servers?: ServerObject[];
|
|
93
|
+
}
|
|
94
|
+
interface ExternalDocumentationObject extends ISpecificationExtension {
|
|
95
|
+
description?: string;
|
|
96
|
+
url: string;
|
|
97
|
+
}
|
|
98
|
+
type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
99
|
+
type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
100
|
+
interface BaseParameterObject extends ISpecificationExtension {
|
|
101
|
+
description?: string;
|
|
102
|
+
required?: boolean;
|
|
103
|
+
deprecated?: boolean;
|
|
104
|
+
allowEmptyValue?: boolean;
|
|
105
|
+
style?: ParameterStyle;
|
|
106
|
+
explode?: boolean;
|
|
107
|
+
allowReserved?: boolean;
|
|
108
|
+
schema?: SchemaObject | ReferenceObject;
|
|
109
|
+
examples?: {
|
|
110
|
+
[param: string]: ExampleObject | ReferenceObject;
|
|
111
|
+
};
|
|
112
|
+
example?: any;
|
|
113
|
+
content?: ContentObject;
|
|
114
|
+
}
|
|
115
|
+
interface ParameterObject extends BaseParameterObject {
|
|
116
|
+
name: string;
|
|
117
|
+
in: ParameterLocation;
|
|
118
|
+
}
|
|
119
|
+
interface RequestBodyObject extends ISpecificationExtension {
|
|
120
|
+
description?: string;
|
|
121
|
+
content: ContentObject;
|
|
122
|
+
required?: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface ContentObject {
|
|
125
|
+
[mediatype: string]: MediaTypeObject;
|
|
126
|
+
}
|
|
127
|
+
interface MediaTypeObject extends ISpecificationExtension {
|
|
128
|
+
schema?: SchemaObject | ReferenceObject;
|
|
129
|
+
examples?: ExamplesObject;
|
|
130
|
+
example?: any;
|
|
131
|
+
encoding?: EncodingObject;
|
|
132
|
+
}
|
|
133
|
+
interface EncodingObject extends ISpecificationExtension {
|
|
134
|
+
[property: string]: EncodingPropertyObject | any;
|
|
135
|
+
}
|
|
136
|
+
interface EncodingPropertyObject {
|
|
137
|
+
contentType?: string;
|
|
138
|
+
headers?: {
|
|
139
|
+
[key: string]: HeaderObject | ReferenceObject;
|
|
140
|
+
};
|
|
141
|
+
style?: string;
|
|
142
|
+
explode?: boolean;
|
|
143
|
+
allowReserved?: boolean;
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
}
|
|
146
|
+
interface ResponsesObject extends ISpecificationExtension {
|
|
147
|
+
default?: ResponseObject | ReferenceObject;
|
|
148
|
+
[statuscode: string]: ResponseObject | ReferenceObject | any;
|
|
149
|
+
}
|
|
150
|
+
interface ResponseObject extends ISpecificationExtension {
|
|
151
|
+
description: string;
|
|
152
|
+
headers?: HeadersObject;
|
|
153
|
+
content?: ContentObject;
|
|
154
|
+
links?: LinksObject;
|
|
155
|
+
}
|
|
156
|
+
interface CallbacksObject extends ISpecificationExtension {
|
|
157
|
+
[name: string]: CallbackObject | ReferenceObject | any;
|
|
158
|
+
}
|
|
159
|
+
interface CallbackObject extends ISpecificationExtension {
|
|
160
|
+
[name: string]: PathItemObject | any;
|
|
161
|
+
}
|
|
162
|
+
interface HeadersObject {
|
|
163
|
+
[name: string]: HeaderObject | ReferenceObject;
|
|
164
|
+
}
|
|
165
|
+
interface ExampleObject {
|
|
166
|
+
summary?: string;
|
|
167
|
+
description?: string;
|
|
168
|
+
value?: any;
|
|
169
|
+
externalValue?: string;
|
|
170
|
+
[property: string]: any;
|
|
171
|
+
}
|
|
172
|
+
interface LinksObject {
|
|
173
|
+
[name: string]: LinkObject | ReferenceObject;
|
|
174
|
+
}
|
|
175
|
+
interface LinkObject extends ISpecificationExtension {
|
|
176
|
+
operationRef?: string;
|
|
177
|
+
operationId?: string;
|
|
178
|
+
parameters?: LinkParametersObject;
|
|
179
|
+
requestBody?: any | string;
|
|
180
|
+
description?: string;
|
|
181
|
+
server?: ServerObject;
|
|
182
|
+
[property: string]: any;
|
|
183
|
+
}
|
|
184
|
+
interface LinkParametersObject {
|
|
185
|
+
[name: string]: any | string;
|
|
186
|
+
}
|
|
187
|
+
interface HeaderObject extends BaseParameterObject {
|
|
188
|
+
$ref?: string;
|
|
189
|
+
}
|
|
190
|
+
interface TagObject extends ISpecificationExtension {
|
|
191
|
+
name: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
externalDocs?: ExternalDocumentationObject;
|
|
194
|
+
[extension: string]: any;
|
|
195
|
+
}
|
|
196
|
+
interface ExamplesObject {
|
|
197
|
+
[name: string]: ExampleObject | ReferenceObject;
|
|
198
|
+
}
|
|
199
|
+
interface ReferenceObject {
|
|
200
|
+
$ref: string;
|
|
201
|
+
}
|
|
202
|
+
type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
|
|
203
|
+
type SchemaObjectFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
|
|
204
|
+
interface SchemaObject extends ISpecificationExtension {
|
|
205
|
+
nullable?: boolean;
|
|
206
|
+
discriminator?: DiscriminatorObject;
|
|
207
|
+
readOnly?: boolean;
|
|
208
|
+
writeOnly?: boolean;
|
|
209
|
+
xml?: XmlObject;
|
|
210
|
+
externalDocs?: ExternalDocumentationObject;
|
|
211
|
+
example?: any;
|
|
212
|
+
examples?: any[];
|
|
213
|
+
deprecated?: boolean;
|
|
214
|
+
type?: SchemaObjectType | SchemaObjectType[];
|
|
215
|
+
format?: SchemaObjectFormat;
|
|
216
|
+
allOf?: (SchemaObject | ReferenceObject)[];
|
|
217
|
+
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
218
|
+
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
219
|
+
not?: SchemaObject | ReferenceObject;
|
|
220
|
+
items?: SchemaObject | ReferenceObject;
|
|
221
|
+
properties?: {
|
|
222
|
+
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
223
|
+
};
|
|
224
|
+
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
225
|
+
description?: string;
|
|
226
|
+
default?: any;
|
|
227
|
+
title?: string;
|
|
228
|
+
multipleOf?: number;
|
|
229
|
+
maximum?: number;
|
|
230
|
+
exclusiveMaximum?: boolean;
|
|
231
|
+
minimum?: number;
|
|
232
|
+
exclusiveMinimum?: boolean;
|
|
233
|
+
maxLength?: number;
|
|
234
|
+
minLength?: number;
|
|
235
|
+
pattern?: string;
|
|
236
|
+
maxItems?: number;
|
|
237
|
+
minItems?: number;
|
|
238
|
+
uniqueItems?: boolean;
|
|
239
|
+
maxProperties?: number;
|
|
240
|
+
minProperties?: number;
|
|
241
|
+
required?: string[];
|
|
242
|
+
enum?: any[];
|
|
243
|
+
}
|
|
244
|
+
interface SchemasObject {
|
|
245
|
+
[schema: string]: SchemaObject;
|
|
246
|
+
}
|
|
247
|
+
interface DiscriminatorObject {
|
|
248
|
+
propertyName: string;
|
|
249
|
+
mapping?: {
|
|
250
|
+
[key: string]: string;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
interface XmlObject extends ISpecificationExtension {
|
|
254
|
+
name?: string;
|
|
255
|
+
namespace?: string;
|
|
256
|
+
prefix?: string;
|
|
257
|
+
attribute?: boolean;
|
|
258
|
+
wrapped?: boolean;
|
|
259
|
+
}
|
|
260
|
+
type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
261
|
+
interface SecuritySchemeObject extends ISpecificationExtension {
|
|
262
|
+
type: SecuritySchemeType;
|
|
263
|
+
description?: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
in?: string;
|
|
266
|
+
scheme?: string;
|
|
267
|
+
bearerFormat?: string;
|
|
268
|
+
flows?: OAuthFlowsObject;
|
|
269
|
+
openIdConnectUrl?: string;
|
|
270
|
+
}
|
|
271
|
+
interface OAuthFlowsObject extends ISpecificationExtension {
|
|
272
|
+
implicit?: OAuthFlowObject;
|
|
273
|
+
password?: OAuthFlowObject;
|
|
274
|
+
clientCredentials?: OAuthFlowObject;
|
|
275
|
+
authorizationCode?: OAuthFlowObject;
|
|
276
|
+
}
|
|
277
|
+
interface OAuthFlowObject extends ISpecificationExtension {
|
|
278
|
+
authorizationUrl?: string;
|
|
279
|
+
tokenUrl?: string;
|
|
280
|
+
refreshUrl?: string;
|
|
281
|
+
scopes: ScopesObject;
|
|
282
|
+
}
|
|
283
|
+
interface ScopesObject extends ISpecificationExtension {
|
|
284
|
+
[scope: string]: any;
|
|
285
|
+
}
|
|
286
|
+
interface SecurityRequirementObject {
|
|
287
|
+
[name: string]: string[];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export { ISpecificationExtension, ServerObject };
|
|
291
|
+
export type { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectFormat, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, TagObject, XmlObject };
|
|
@@ -59,9 +59,6 @@ interface ComponentsObject extends ISpecificationExtension {
|
|
|
59
59
|
callbacks?: {
|
|
60
60
|
[callback: string]: CallbackObject | ReferenceObject;
|
|
61
61
|
};
|
|
62
|
-
pathItems?: {
|
|
63
|
-
[pathItem: string]: PathItemObject | ReferenceObject;
|
|
64
|
-
};
|
|
65
62
|
}
|
|
66
63
|
interface PathsObject extends ISpecificationExtension {
|
|
67
64
|
[path: string]: PathItemObject;
|
|
@@ -208,7 +205,6 @@ interface ReferenceObject {
|
|
|
208
205
|
}
|
|
209
206
|
type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
|
|
210
207
|
interface SchemaObject extends ISpecificationExtension {
|
|
211
|
-
$ref?: string;
|
|
212
208
|
discriminator?: DiscriminatorObject;
|
|
213
209
|
readOnly?: boolean;
|
|
214
210
|
writeOnly?: boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectFormat, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, TagObject, XmlObject } from './model/openapi30.js';
|
|
2
|
+
export { IExtensionName, IExtensionType, ISpecificationExtension } from './model/specification-extension.js';
|
|
3
|
+
export { ServerObject, ServerVariableObject } from './model/oas-common.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, TagObject, XmlObject } from './
|
|
2
|
-
export { IExtensionName, IExtensionType, ISpecificationExtension } from './
|
|
3
|
-
export { ServerObject, ServerVariableObject } from './
|
|
1
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, TagObject, XmlObject } from './model/openapi31.js';
|
|
2
|
+
export { IExtensionName, IExtensionType, ISpecificationExtension } from './model/specification-extension.js';
|
|
3
|
+
export { ServerObject, ServerVariableObject } from './model/oas-common.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../dist/extend";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod-openapi",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.5",
|
|
4
4
|
"description": "Convert Zod Schemas to OpenAPI v3.x documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"@redocly/cli": "1.34.3",
|
|
78
78
|
"@types/node": "22.15.21",
|
|
79
79
|
"eslint-plugin-zod-openapi": "1.0.0",
|
|
80
|
-
"openapi3-ts": "4.
|
|
81
|
-
"skuba": "11.0.1",
|
|
80
|
+
"openapi3-ts": "4.4.0",
|
|
81
|
+
"skuba": "11.0.1-fix-node16-compatibility-20250523051131",
|
|
82
82
|
"yaml": "2.8.0",
|
|
83
|
-
"zod": "3.25.
|
|
83
|
+
"zod": "3.25.23"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"zod": "^3.
|
|
86
|
+
"zod": "^3.21.4"
|
|
87
87
|
},
|
|
88
88
|
"packageManager": "pnpm@10.11.0",
|
|
89
89
|
"engines": {
|