zod-openapi 4.2.1 → 4.2.2
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/dist/components.chunk.cjs +5 -5
- package/dist/components.chunk.mjs +1 -1
- package/dist/extend.cjs +0 -4
- package/dist/extend.d.mts +1 -1
- package/dist/extend.d.ts +1 -1
- package/dist/extend.mjs +0 -5
- package/dist/extendZod.chunk.cjs +12 -12
- package/dist/extendZod.chunk.mjs +1 -1
- package/dist/extendZod.d.ts +1 -0
- package/dist/extendZodSymbols.d.ts +4 -0
- package/dist/extendZodTypes.d.ts +1 -4
- package/package.json +1 -1
- /package/dist/{extendZodTypes.chunk.cjs → extendZodSymbols.chunk.cjs} +0 -0
- /package/dist/{extendZodTypes.chunk.mjs → extendZodSymbols.chunk.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const extendZodSymbols = require("./extendZodSymbols.chunk.cjs");
|
|
3
3
|
const isZodType = (zodType, typeName) => {
|
|
4
4
|
var _a;
|
|
5
5
|
return ((_a = zodType == null ? void 0 : zodType._def) == null ? void 0 : _a.typeName) === typeName;
|
|
@@ -1539,13 +1539,13 @@ const createSchemaOrRef = (zodSchema, state, onlyRef) => {
|
|
|
1539
1539
|
if (existingRef) {
|
|
1540
1540
|
return existingRef;
|
|
1541
1541
|
}
|
|
1542
|
-
const previous = ((_a = zodSchema._def.zodOpenApi) == null ? void 0 : _a[
|
|
1543
|
-
zodSchema._def.zodOpenApi[
|
|
1542
|
+
const previous = ((_a = zodSchema._def.zodOpenApi) == null ? void 0 : _a[extendZodSymbols.previousSymbol]) ? createSchemaOrRef(
|
|
1543
|
+
zodSchema._def.zodOpenApi[extendZodSymbols.previousSymbol],
|
|
1544
1544
|
state,
|
|
1545
1545
|
true
|
|
1546
1546
|
) : void 0;
|
|
1547
|
-
const current = ((_b = zodSchema._def.zodOpenApi) == null ? void 0 : _b[
|
|
1548
|
-
zodSchema._def.zodOpenApi[
|
|
1547
|
+
const current = ((_b = zodSchema._def.zodOpenApi) == null ? void 0 : _b[extendZodSymbols.currentSymbol]) && zodSchema._def.zodOpenApi[extendZodSymbols.currentSymbol] !== zodSchema ? createSchemaOrRef(
|
|
1548
|
+
zodSchema._def.zodOpenApi[extendZodSymbols.currentSymbol],
|
|
1549
1549
|
state,
|
|
1550
1550
|
true
|
|
1551
1551
|
) : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { previousSymbol, currentSymbol } from "./
|
|
1
|
+
import { previousSymbol, currentSymbol } from "./extendZodSymbols.chunk.mjs";
|
|
2
2
|
const isZodType = (zodType, typeName) => {
|
|
3
3
|
var _a;
|
|
4
4
|
return ((_a = zodType == null ? void 0 : zodType._def) == null ? void 0 : _a.typeName) === typeName;
|
package/dist/extend.cjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
2
|
const zod = require("zod");
|
|
4
3
|
const extendZod = require("./extendZod.chunk.cjs");
|
|
5
|
-
const extendZodTypes = require("./extendZodTypes.chunk.cjs");
|
|
6
4
|
extendZod.extendZodWithOpenApi(zod.z);
|
|
7
|
-
exports.currentSymbol = extendZodTypes.currentSymbol;
|
|
8
|
-
exports.previousSymbol = extendZodTypes.previousSymbol;
|
package/dist/extend.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import './extendZodTypes.js';
|
package/dist/extend.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import './extendZodTypes.js';
|
package/dist/extend.mjs
CHANGED
package/dist/extendZod.chunk.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const extendZodSymbols = require("./extendZodSymbols.chunk.cjs");
|
|
3
3
|
const mergeOpenApi = (openapi, {
|
|
4
4
|
ref: _ref,
|
|
5
5
|
refType: _refType,
|
|
@@ -25,9 +25,9 @@ function extendZodWithOpenApi(zod) {
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
result._def.zodOpenApi[
|
|
28
|
+
result._def.zodOpenApi[extendZodSymbols.currentSymbol] = result;
|
|
29
29
|
if (zodOpenApi) {
|
|
30
|
-
result._def.zodOpenApi[
|
|
30
|
+
result._def.zodOpenApi[extendZodSymbols.previousSymbol] = this;
|
|
31
31
|
}
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
@@ -38,13 +38,13 @@ function extendZodWithOpenApi(zod) {
|
|
|
38
38
|
if (def.zodOpenApi) {
|
|
39
39
|
const cloned = { ...def.zodOpenApi };
|
|
40
40
|
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
|
41
|
-
cloned[
|
|
42
|
-
cloned[
|
|
41
|
+
cloned[extendZodSymbols.previousSymbol] = this;
|
|
42
|
+
cloned[extendZodSymbols.currentSymbol] = result;
|
|
43
43
|
def.zodOpenApi = cloned;
|
|
44
44
|
} else {
|
|
45
45
|
def.zodOpenApi = {
|
|
46
46
|
openapi: { description: args[0] },
|
|
47
|
-
[
|
|
47
|
+
[extendZodSymbols.currentSymbol]: result
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
return result;
|
|
@@ -56,11 +56,11 @@ function extendZodWithOpenApi(zod) {
|
|
|
56
56
|
if (zodOpenApi) {
|
|
57
57
|
const cloned = { ...zodOpenApi };
|
|
58
58
|
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
59
|
-
cloned[
|
|
59
|
+
cloned[extendZodSymbols.previousSymbol] = this;
|
|
60
60
|
extendResult._def.zodOpenApi = cloned;
|
|
61
61
|
} else {
|
|
62
62
|
extendResult._def.zodOpenApi = {
|
|
63
|
-
[
|
|
63
|
+
[extendZodSymbols.previousSymbol]: this
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
return extendResult;
|
|
@@ -72,8 +72,8 @@ function extendZodWithOpenApi(zod) {
|
|
|
72
72
|
if (zodOpenApi) {
|
|
73
73
|
const cloned = { ...zodOpenApi };
|
|
74
74
|
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
75
|
-
delete cloned[
|
|
76
|
-
delete cloned[
|
|
75
|
+
delete cloned[extendZodSymbols.previousSymbol];
|
|
76
|
+
delete cloned[extendZodSymbols.currentSymbol];
|
|
77
77
|
omitResult._def.zodOpenApi = cloned;
|
|
78
78
|
}
|
|
79
79
|
return omitResult;
|
|
@@ -85,8 +85,8 @@ function extendZodWithOpenApi(zod) {
|
|
|
85
85
|
if (zodOpenApi) {
|
|
86
86
|
const cloned = { ...zodOpenApi };
|
|
87
87
|
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
88
|
-
delete cloned[
|
|
89
|
-
delete cloned[
|
|
88
|
+
delete cloned[extendZodSymbols.previousSymbol];
|
|
89
|
+
delete cloned[extendZodSymbols.currentSymbol];
|
|
90
90
|
pickResult._def.zodOpenApi = cloned;
|
|
91
91
|
}
|
|
92
92
|
return pickResult;
|
package/dist/extendZod.chunk.mjs
CHANGED
package/dist/extendZod.d.ts
CHANGED
package/dist/extendZodTypes.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ZodTypeAny, z, ZodObject } from 'zod';
|
|
2
2
|
import { CreationType } from './create/components.js';
|
|
3
|
+
import { currentSymbol, previousSymbol } from './extendZodSymbols.js';
|
|
3
4
|
import { HeaderObject as HeaderObject$1, SchemaObject as SchemaObject$1 } from './openapi3-ts/dist/model/openapi30.js';
|
|
4
5
|
import { ParameterObject, ExampleObject, ReferenceObject, HeaderObject, SchemaObject as SchemaObject$2 } from './openapi3-ts/dist/model/openapi31.js';
|
|
5
6
|
|
|
6
7
|
type SchemaObject = SchemaObject$1 & SchemaObject$2;
|
|
7
8
|
type ReplaceDate<T> = T extends Date ? Date | string : T;
|
|
8
|
-
declare const currentSymbol: unique symbol;
|
|
9
|
-
declare const previousSymbol: unique symbol;
|
|
10
9
|
/**
|
|
11
10
|
* zod-openapi metadata
|
|
12
11
|
*/
|
|
@@ -90,5 +89,3 @@ declare module 'zod' {
|
|
|
90
89
|
extendMetadata?: ZodOpenApiExtendMetadata;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
export { currentSymbol, previousSymbol };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|