zod-openapi 2.4.0-beta.1 → 2.4.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 +4 -5
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/openapi3-ts/dist/index.js +1 -4
- package/lib-commonjs/openapi3-ts/dist/index.js.map +1 -1
- package/lib-commonjs/openapi3-ts/dist/oas30.js +0 -4
- package/lib-commonjs/openapi3-ts/dist/oas30.js.map +1 -1
- package/lib-commonjs/openapi3-ts/dist/oas31.js +0 -4
- package/lib-commonjs/openapi3-ts/dist/oas31.js.map +1 -1
- package/lib-es2015/index.js +1 -0
- package/lib-es2015/index.js.map +1 -1
- package/lib-es2015/openapi3-ts/dist/index.js +0 -1
- package/lib-es2015/openapi3-ts/dist/index.js.map +1 -1
- package/lib-es2015/openapi3-ts/dist/oas30.js +0 -1
- package/lib-es2015/openapi3-ts/dist/oas30.js.map +1 -1
- package/lib-es2015/openapi3-ts/dist/oas31.js +0 -1
- package/lib-es2015/openapi3-ts/dist/oas31.js.map +1 -1
- package/lib-types/index.d.ts +1 -1
- package/lib-types/openapi3-ts/dist/index.d.ts +1 -1
- package/lib-types/openapi3-ts/dist/oas30.d.ts +1 -1
- package/lib-types/openapi3-ts/dist/oas31.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -276,9 +276,7 @@ const title = z.string().openapi({
|
|
|
276
276
|
Wherever `title` is used in schemas across the document, it will instead be created as a reference.
|
|
277
277
|
|
|
278
278
|
```json
|
|
279
|
-
{
|
|
280
|
-
"title": { "$ref": "#/components/schemas/jobTitle" }
|
|
281
|
-
}
|
|
279
|
+
{ "$ref": "#/components/schemas/jobTitle" }
|
|
282
280
|
```
|
|
283
281
|
|
|
284
282
|
`title` will then be outputted as a schema within the components section of the documentation.
|
|
@@ -309,7 +307,7 @@ eg.
|
|
|
309
307
|
createDocument({
|
|
310
308
|
components: {
|
|
311
309
|
schemas: {
|
|
312
|
-
jobTitle, // this will register this Zod Schema as jobTitle unless `ref` in `.openapi()` is specified on the type
|
|
310
|
+
jobTitle: title, // this will register this Zod Schema as jobTitle unless `ref` in `.openapi()` is specified on the type
|
|
313
311
|
},
|
|
314
312
|
},
|
|
315
313
|
});
|
|
@@ -323,7 +321,7 @@ If a registered schema with a transform or pipeline is used in both a request an
|
|
|
323
321
|
|
|
324
322
|
`.preprocess()` will always return the `output` type even if we are creating an input schema. If a different input type is required you can achieve this with a `.transform()` combined with a `.pipe()` or simply declare a manual `type` in `.openapi()`.
|
|
325
323
|
|
|
326
|
-
If you are adding
|
|
324
|
+
If you are adding a ZodSchema directly to the `components` section which is not referenced anywhere in the document, additional context may be required to create either an input schema or an output schema. You can do this by setting the `refType` field to `input` or `output` in `.openapi()`. This defaults to `output` by default.
|
|
327
325
|
|
|
328
326
|
#### Parameters
|
|
329
327
|
|
|
@@ -501,6 +499,7 @@ For example in `z.string().nullable()` will be rendered differently
|
|
|
501
499
|
- `refine` full support
|
|
502
500
|
- ZodEnum
|
|
503
501
|
- ZodLazy
|
|
502
|
+
- The recursive schema within the ZodLazy or the ZodLazy _**must**_ be registered as a component. See [Creating Components](#creating-components) for more information.
|
|
504
503
|
- ZodLiteral
|
|
505
504
|
- ZodNativeEnum
|
|
506
505
|
- supporting `string`, `number` and combined enums.
|
package/lib-commonjs/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./create/document"), exports);
|
|
18
18
|
__exportStar(require("./extendZod"), exports);
|
|
19
|
+
__exportStar(require("./openapi3-ts/dist"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8CAA4B;AAC5B,qDAAmC"}
|
|
@@ -23,10 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.oas31 = exports.oas30 = void 0;
|
|
27
27
|
exports.oas30 = __importStar(require("./oas30"));
|
|
28
28
|
exports.oas31 = __importStar(require("./oas31"));
|
|
29
|
-
var server_1 = require("./model/server");
|
|
30
|
-
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } });
|
|
31
|
-
Object.defineProperty(exports, "ServerVariable", { enumerable: true, get: function () { return server_1.ServerVariable; } });
|
|
32
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiC;AACjC,iDAAiC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiC;AACjC,iDAAiC"}
|
|
@@ -14,10 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ServerVariable = exports.Server = void 0;
|
|
18
17
|
__exportStar(require("./dsl/openapi-builder30"), exports);
|
|
19
18
|
__exportStar(require("./model/openapi30"), exports);
|
|
20
|
-
var server_1 = require("./model/server");
|
|
21
|
-
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } });
|
|
22
|
-
Object.defineProperty(exports, "ServerVariable", { enumerable: true, get: function () { return server_1.ServerVariable; } });
|
|
23
19
|
//# sourceMappingURL=oas30.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oas30.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas30.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oas30.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas30.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oDAAkC"}
|
|
@@ -14,10 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ServerVariable = exports.Server = void 0;
|
|
18
17
|
__exportStar(require("./dsl/openapi-builder31"), exports);
|
|
19
18
|
__exportStar(require("./model/openapi31"), exports);
|
|
20
|
-
var server_1 = require("./model/server");
|
|
21
|
-
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } });
|
|
22
|
-
Object.defineProperty(exports, "ServerVariable", { enumerable: true, get: function () { return server_1.ServerVariable; } });
|
|
23
19
|
//# sourceMappingURL=oas31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oas31.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas31.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oas31.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas31.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oDAAkC"}
|
package/lib-es2015/index.js
CHANGED
package/lib-es2015/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/index.ts"],"names":[],"mappings":"yBAAuB,SAAS;oBAApB,KAAK;yBACM,SAAS;oBAApB,KAAK
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/index.ts"],"names":[],"mappings":"yBAAuB,SAAS;oBAApB,KAAK;yBACM,SAAS;oBAApB,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oas30.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas30.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"oas30.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas30.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oas31.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas31.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"oas31.js","sourceRoot":"","sources":["../../../src/openapi3-ts/dist/oas31.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
|
package/lib-types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './dsl/openapi-builder30';
|
|
2
2
|
export * from './model/openapi30';
|
|
3
|
-
export { Server, ServerVariable } from './model/server';
|
|
3
|
+
export type { Server, ServerVariable } from './model/server';
|
|
4
4
|
export type { IExtensionName, IExtensionType, ISpecificationExtension } from './model/specification-extension';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './dsl/openapi-builder31';
|
|
2
2
|
export * from './model/openapi31';
|
|
3
|
-
export { Server, ServerVariable } from './model/server';
|
|
3
|
+
export type { Server, ServerVariable } from './model/server';
|
|
4
4
|
export type { IExtensionName, IExtensionType, ISpecificationExtension } from './model/specification-extension';
|