zod-openapi 5.0.0-beta.1 → 5.0.0-beta.10
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 +73 -210
- package/api/index.d.ts +1 -1
- package/dist/api.d.mts +11 -3
- package/dist/api.d.ts +11 -3
- package/dist/api.js +6 -0
- package/dist/api.mjs +3 -8
- package/dist/components-Cp63fKGN.js +805 -0
- package/dist/components-CtvxFnRF.d.ts +559 -0
- package/dist/components-DKJ1Dtzd.mjs +747 -0
- package/dist/components-DLZ-sf1V.d.mts +559 -0
- package/dist/index.d.mts +23 -7
- package/dist/index.d.ts +23 -7
- package/dist/index.js +19 -0
- package/dist/index.mjs +17 -59
- package/package.json +13 -34
- package/dist/api.cjs +0 -8
- package/dist/components.chunk.cjs +0 -2463
- package/dist/components.chunk.mjs +0 -2464
- package/dist/create/components.d.ts +0 -125
- package/dist/create/content.d.ts +0 -8
- package/dist/create/document.d.ts +0 -91
- package/dist/create/parameters.d.ts +0 -9
- package/dist/create/schema/single.d.ts +0 -33
- package/dist/extend.cjs +0 -4
- package/dist/extend.d.mts +0 -1
- package/dist/extend.d.ts +0 -1
- package/dist/extend.mjs +0 -3
- package/dist/extendZod.chunk.cjs +0 -95
- package/dist/extendZod.chunk.mjs +0 -96
- package/dist/extendZod.d.ts +0 -6
- package/dist/extendZodSymbols.chunk.cjs +0 -5
- package/dist/extendZodSymbols.chunk.mjs +0 -6
- package/dist/extendZodSymbols.d.ts +0 -4
- package/dist/extendZodTypes.d.ts +0 -91
- package/dist/index.cjs +0 -60
- 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/openapi30.d.ts +0 -291
- package/dist/openapi3-ts/dist/model/openapi31.d.ts +0 -298
- package/dist/openapi3-ts/dist/model/specification-extension.d.ts +0 -7
- package/dist/openapi3-ts/dist/oas30.d.ts +0 -3
- package/dist/openapi3-ts/dist/oas31.d.ts +0 -3
- package/extend/index.d.ts +0 -1
- package/extend/package.json +0 -5
package/dist/index.mjs
CHANGED
|
@@ -1,60 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
};
|
|
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" }));
|
|
54
|
-
export {
|
|
55
|
-
createDocument,
|
|
56
|
-
createSchema,
|
|
57
|
-
extendZodWithOpenApi,
|
|
58
|
-
oas30,
|
|
59
|
-
oas31
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-DKJ1Dtzd.mjs";
|
|
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 = 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;
|
|
60
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.10",
|
|
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,21 +52,21 @@
|
|
|
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
57
|
"eslint-plugin-zod-openapi": "1.0.0",
|
|
80
|
-
"openapi3-ts": "4.
|
|
81
|
-
"skuba": "11.0.1
|
|
58
|
+
"openapi3-ts": "4.5.0",
|
|
59
|
+
"skuba": "11.0.1",
|
|
60
|
+
"tsdown": "0.12.9",
|
|
82
61
|
"yaml": "2.8.0",
|
|
83
|
-
"zod": "3.25.
|
|
62
|
+
"zod": "3.25.67"
|
|
84
63
|
},
|
|
85
64
|
"peerDependencies": {
|
|
86
|
-
"zod": "^3.
|
|
65
|
+
"zod": "^3.25.67"
|
|
87
66
|
},
|
|
88
67
|
"packageManager": "pnpm@10.11.0",
|
|
89
68
|
"engines": {
|
|
90
|
-
"node": ">=
|
|
69
|
+
"node": ">=20"
|
|
91
70
|
},
|
|
92
71
|
"publishConfig": {
|
|
93
72
|
"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.createMediaTypeSchema = components.createMediaTypeSchema;
|
|
6
|
-
exports.createParamOrRef = components.createParamOrRef;
|
|
7
|
-
exports.getDefaultComponents = components.getDefaultComponents;
|
|
8
|
-
exports.getZodObject = components.getZodObject;
|