zod-openapi 5.0.0-beta.2 → 5.0.0-beta.20
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 +191 -46
- package/api/index.d.ts +1 -1
- package/dist/api.d.mts +11 -5
- package/dist/api.d.ts +11 -5
- package/dist/api.js +6 -0
- package/dist/api.mjs +3 -8
- package/dist/components-BLmIpmmY.d.ts +628 -0
- package/dist/components-BVy-T4wz.mjs +892 -0
- package/dist/components-DkESnIB9.d.mts +628 -0
- package/dist/components-XnOyQ3JZ.js +950 -0
- package/dist/index.d.mts +25 -5
- package/dist/index.d.ts +25 -5
- package/dist/index.js +19 -0
- package/dist/index.mjs +16 -22
- package/package.json +11 -31
- package/dist/api.cjs +0 -8
- package/dist/components.chunk.cjs +0 -1085
- package/dist/components.chunk.mjs +0 -1086
- package/dist/create/components.d.ts +0 -85
- package/dist/create/content.d.ts +0 -10
- package/dist/create/document.d.ts +0 -97
- package/dist/create/object.d.ts +0 -5
- package/dist/create/parameters.d.ts +0 -14
- package/dist/create/schema/schema.d.ts +0 -21
- package/dist/index.cjs +0 -23
- package/dist/openapi.d.ts +0 -5
- package/dist/openapi3-ts/dist/model/oas-common.d.ts +0 -16
- package/dist/openapi3-ts/dist/model/openapi31.d.ts +0 -302
- package/dist/openapi3-ts/dist/model/specification-extension.d.ts +0 -7
- package/dist/openapi3-ts/oas31.d.ts +0 -3
- package/dist/zod.d.ts +0 -49
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument } from "./components-DkESnIB9.mjs";
|
|
2
|
+
import { core } from "zod/v4";
|
|
3
|
+
|
|
4
|
+
//#region rolldown:runtime
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/create/schema/schema.d.ts
|
|
7
|
+
interface SchemaResult {
|
|
8
|
+
schema: SchemaObject | ReferenceObject;
|
|
9
|
+
components: Record<string, SchemaObject>;
|
|
10
|
+
}
|
|
11
|
+
declare const createSchema: (schema: core.$ZodType, ctx?: {
|
|
12
|
+
registry?: ComponentRegistry;
|
|
13
|
+
io?: "input" | "output";
|
|
14
|
+
opts?: CreateDocumentOptions & {
|
|
15
|
+
schemaComponents?: ZodOpenApiComponentsObject["schemas"];
|
|
16
|
+
};
|
|
17
|
+
}) => {
|
|
18
|
+
schema: SchemaObject | ReferenceObject;
|
|
19
|
+
components: Record<string, SchemaObject>;
|
|
20
|
+
};
|
|
21
|
+
declare namespace oas31_d_exports {
|
|
22
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, 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, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CreateDocumentOptions, Override, SchemaResult, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument, createSchema, oas31_d_exports as oas31 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument } from "./components-BLmIpmmY.js";
|
|
2
|
+
import { core } from "zod/v4";
|
|
3
|
+
|
|
4
|
+
//#region rolldown:runtime
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/create/schema/schema.d.ts
|
|
7
|
+
interface SchemaResult {
|
|
8
|
+
schema: SchemaObject | ReferenceObject;
|
|
9
|
+
components: Record<string, SchemaObject>;
|
|
10
|
+
}
|
|
11
|
+
declare const createSchema: (schema: core.$ZodType, ctx?: {
|
|
12
|
+
registry?: ComponentRegistry;
|
|
13
|
+
io?: "input" | "output";
|
|
14
|
+
opts?: CreateDocumentOptions & {
|
|
15
|
+
schemaComponents?: ZodOpenApiComponentsObject["schemas"];
|
|
16
|
+
};
|
|
17
|
+
}) => {
|
|
18
|
+
schema: SchemaObject | ReferenceObject;
|
|
19
|
+
components: Record<string, SchemaObject>;
|
|
20
|
+
};
|
|
21
|
+
declare namespace oas31_d_exports {
|
|
22
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, 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, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CreateDocumentOptions, Override, SchemaResult, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument, createSchema, oas31_d_exports as oas31 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_components = require('./components-XnOyQ3JZ.js');
|
|
2
|
+
|
|
3
|
+
//#region src/create/document.ts
|
|
4
|
+
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
5
|
+
const { paths, webhooks, components,...rest } = zodOpenApiObject;
|
|
6
|
+
const document = rest;
|
|
7
|
+
const registry = require_components.createRegistry(components);
|
|
8
|
+
const createdPaths = require_components.createPaths(paths, registry, ["paths"]);
|
|
9
|
+
if (createdPaths) document.paths = createdPaths;
|
|
10
|
+
const createdWebhooks = require_components.createPaths(webhooks, registry, ["webhooks"]);
|
|
11
|
+
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
12
|
+
const createdComponents = require_components.createComponents(registry, opts);
|
|
13
|
+
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
14
|
+
return document;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.createDocument = createDocument;
|
|
19
|
+
exports.createSchema = require_components.createSchema;
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-BVy-T4wz.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/create/document.ts
|
|
3
4
|
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const createdComponents = createComponents(registry, opts);
|
|
16
|
-
if (Object.keys(createdComponents).length > 0) {
|
|
17
|
-
document.components = createdComponents;
|
|
18
|
-
}
|
|
19
|
-
return document;
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
createDocument,
|
|
23
|
-
createSchema
|
|
5
|
+
const { paths, webhooks, components,...rest } = zodOpenApiObject;
|
|
6
|
+
const document = rest;
|
|
7
|
+
const registry = createRegistry(components);
|
|
8
|
+
const createdPaths = createPaths(paths, registry, ["paths"]);
|
|
9
|
+
if (createdPaths) document.paths = createdPaths;
|
|
10
|
+
const createdWebhooks = createPaths(webhooks, registry, ["webhooks"]);
|
|
11
|
+
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
12
|
+
const createdComponents = createComponents(registry, opts);
|
|
13
|
+
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
14
|
+
return document;
|
|
24
15
|
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { createDocument, createSchema };
|
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.20",
|
|
4
4
|
"description": "Convert Zod Schemas to OpenAPI v3.x documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -20,48 +20,27 @@
|
|
|
20
20
|
"url": "git+ssh://git@github.com/samchungy/zod-openapi.git"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"sideEffects":
|
|
24
|
-
"dist/extend.*",
|
|
25
|
-
"dist/side-effects/**",
|
|
26
|
-
"src/entries/extend.ts"
|
|
27
|
-
],
|
|
23
|
+
"sideEffects": false,
|
|
28
24
|
"exports": {
|
|
29
25
|
".": {
|
|
30
|
-
"types": {
|
|
31
|
-
"import": "./dist/index.d.mts",
|
|
32
|
-
"require": "./dist/index.d.ts"
|
|
33
|
-
},
|
|
34
26
|
"import": "./dist/index.mjs",
|
|
35
|
-
"require": "./dist/index.
|
|
27
|
+
"require": "./dist/index.js"
|
|
36
28
|
},
|
|
37
29
|
"./api": {
|
|
38
|
-
"types": {
|
|
39
|
-
"import": "./dist/api.d.mts",
|
|
40
|
-
"require": "./dist/api.d.ts"
|
|
41
|
-
},
|
|
42
30
|
"import": "./dist/api.mjs",
|
|
43
|
-
"require": "./dist/api.
|
|
44
|
-
},
|
|
45
|
-
"./extend": {
|
|
46
|
-
"types": {
|
|
47
|
-
"import": "./dist/extend.d.mts",
|
|
48
|
-
"require": "./dist/extend.d.ts"
|
|
49
|
-
},
|
|
50
|
-
"import": "./dist/extend.mjs",
|
|
51
|
-
"require": "./dist/extend.cjs"
|
|
31
|
+
"require": "./dist/api.js"
|
|
52
32
|
},
|
|
53
33
|
"./package.json": "./package.json"
|
|
54
34
|
},
|
|
55
|
-
"main": "./dist/index.
|
|
35
|
+
"main": "./dist/index.js",
|
|
56
36
|
"module": "./dist/index.mjs",
|
|
57
37
|
"types": "./dist/index.d.ts",
|
|
58
38
|
"files": [
|
|
59
|
-
"api",
|
|
60
39
|
"dist",
|
|
61
|
-
"
|
|
40
|
+
"api"
|
|
62
41
|
],
|
|
63
42
|
"scripts": {
|
|
64
|
-
"build": "pnpm copy:types &&
|
|
43
|
+
"build": "pnpm copy:types && tsdown",
|
|
65
44
|
"copy:types": "skuba node scripts/copyTypes.ts",
|
|
66
45
|
"create:docs": " skuba node examples/simple/createSchema.ts && redocly build-docs examples/simple/openapi.yml --output=examples/simple/redoc-static.html",
|
|
67
46
|
"format": "skuba format",
|
|
@@ -73,12 +52,13 @@
|
|
|
73
52
|
},
|
|
74
53
|
"devDependencies": {
|
|
75
54
|
"@arethetypeswrong/cli": "0.18.1",
|
|
76
|
-
"@crackle/cli": "0.16.0",
|
|
77
55
|
"@redocly/cli": "1.34.3",
|
|
78
56
|
"@types/node": "22.15.21",
|
|
79
|
-
"eslint-plugin-zod
|
|
57
|
+
"eslint-plugin-import-zod": "1.0.3",
|
|
58
|
+
"eslint-plugin-zod-openapi": "2.0.0-beta.1",
|
|
80
59
|
"openapi3-ts": "4.5.0",
|
|
81
60
|
"skuba": "11.0.1",
|
|
61
|
+
"tsdown": "0.12.9",
|
|
82
62
|
"yaml": "2.8.0",
|
|
83
63
|
"zod": "3.25.67"
|
|
84
64
|
},
|
|
@@ -87,7 +67,7 @@
|
|
|
87
67
|
},
|
|
88
68
|
"packageManager": "pnpm@10.11.0",
|
|
89
69
|
"engines": {
|
|
90
|
-
"node": ">=
|
|
70
|
+
"node": ">=20"
|
|
91
71
|
},
|
|
92
72
|
"publishConfig": {
|
|
93
73
|
"provenance": true,
|
package/dist/api.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const components = require("./components.chunk.cjs");
|
|
4
|
-
exports.createComponents = components.createComponents;
|
|
5
|
-
exports.createMediaTypeObject = components.createMediaTypeObject;
|
|
6
|
-
exports.createParameter = components.createParameter;
|
|
7
|
-
exports.createRegistry = components.createRegistry;
|
|
8
|
-
exports.unwrapZodObject = components.unwrapZodObject;
|