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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const extendZodTypes = require("./extendZodTypes.chunk.cjs");
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[extendZodTypes.previousSymbol]) ? createSchemaOrRef(
1543
- zodSchema._def.zodOpenApi[extendZodTypes.previousSymbol],
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[extendZodTypes.currentSymbol]) && zodSchema._def.zodOpenApi[extendZodTypes.currentSymbol] !== zodSchema ? createSchemaOrRef(
1548
- zodSchema._def.zodOpenApi[extendZodTypes.currentSymbol],
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 "./extendZodTypes.chunk.mjs";
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
- export { currentSymbol, previousSymbol } from './extendZodTypes.js';
1
+ import './extendZodTypes.js';
package/dist/extend.d.ts CHANGED
@@ -1 +1 @@
1
- export { currentSymbol, previousSymbol } from './extendZodTypes.js';
1
+ import './extendZodTypes.js';
package/dist/extend.mjs CHANGED
@@ -1,8 +1,3 @@
1
1
  import { z } from "zod";
2
2
  import { extendZodWithOpenApi } from "./extendZod.chunk.mjs";
3
- import { currentSymbol, previousSymbol } from "./extendZodTypes.chunk.mjs";
4
3
  extendZodWithOpenApi(z);
5
- export {
6
- currentSymbol,
7
- previousSymbol
8
- };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const extendZodTypes = require("./extendZodTypes.chunk.cjs");
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[extendZodTypes.currentSymbol] = result;
28
+ result._def.zodOpenApi[extendZodSymbols.currentSymbol] = result;
29
29
  if (zodOpenApi) {
30
- result._def.zodOpenApi[extendZodTypes.previousSymbol] = this;
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[extendZodTypes.previousSymbol] = this;
42
- cloned[extendZodTypes.currentSymbol] = result;
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
- [extendZodTypes.currentSymbol]: result
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[extendZodTypes.previousSymbol] = this;
59
+ cloned[extendZodSymbols.previousSymbol] = this;
60
60
  extendResult._def.zodOpenApi = cloned;
61
61
  } else {
62
62
  extendResult._def.zodOpenApi = {
63
- [extendZodTypes.previousSymbol]: this
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[extendZodTypes.previousSymbol];
76
- delete cloned[extendZodTypes.currentSymbol];
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[extendZodTypes.previousSymbol];
89
- delete cloned[extendZodTypes.currentSymbol];
88
+ delete cloned[extendZodSymbols.previousSymbol];
89
+ delete cloned[extendZodSymbols.currentSymbol];
90
90
  pickResult._def.zodOpenApi = cloned;
91
91
  }
92
92
  return pickResult;
@@ -1,4 +1,4 @@
1
- import { currentSymbol, previousSymbol } from "./extendZodTypes.chunk.mjs";
1
+ import { currentSymbol, previousSymbol } from "./extendZodSymbols.chunk.mjs";
2
2
  const mergeOpenApi = (openapi, {
3
3
  ref: _ref,
4
4
  refType: _refType,
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import './extendZodTypes.js';
2
3
 
3
4
  declare function extendZodWithOpenApi(zod: typeof z): void;
4
5
 
@@ -0,0 +1,4 @@
1
+ declare const currentSymbol: unique symbol;
2
+ declare const previousSymbol: unique symbol;
3
+
4
+ export { currentSymbol, previousSymbol };
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",