zod-nest 3.2.5 → 3.3.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/dist/index.mjs CHANGED
@@ -1085,7 +1085,16 @@ var HTTP_METHODS = [
1085
1085
  "options",
1086
1086
  "head",
1087
1087
  "patch",
1088
- "trace"
1088
+ "trace",
1089
+ "query",
1090
+ "search",
1091
+ "propfind",
1092
+ "proppatch",
1093
+ "mkcol",
1094
+ "copy",
1095
+ "move",
1096
+ "lock",
1097
+ "unlock"
1089
1098
  ];
1090
1099
  var forEachOperation = /* @__PURE__ */ __name((doc, fn) => {
1091
1100
  const paths = doc.paths;
@@ -1715,6 +1724,25 @@ var decorateIfPresent = /* @__PURE__ */ __name((schemas, key) => {
1715
1724
  };
1716
1725
  }, "decorateIfPresent");
1717
1726
 
1727
+ // src/document/openapi-version.ts
1728
+ var SUPPORTED_OPENAPI_SERIES = [
1729
+ "3.1",
1730
+ "3.2"
1731
+ ];
1732
+ var DEFAULT_OPENAPI_VERSION = "3.1.0";
1733
+ var SUPPORTED_VERSION_PATTERN = /^3\.[12]\.\d+(?:-.+)?$/;
1734
+ var resolveOpenApiVersion = /* @__PURE__ */ __name((doc) => {
1735
+ const declared = doc.openapi;
1736
+ if (typeof declared !== "string" || declared === "") {
1737
+ return DEFAULT_OPENAPI_VERSION;
1738
+ }
1739
+ if (SUPPORTED_VERSION_PATTERN.test(declared)) {
1740
+ return declared;
1741
+ }
1742
+ console.warn(`[zod-nest] Document declares OpenAPI \`${declared}\`, which zod-nest does not emit; emitting \`${DEFAULT_OPENAPI_VERSION}\` instead. Supported: ${SUPPORTED_OPENAPI_SERIES.map((series) => `${series}.x`).join(", ")}. Set one via \`DocumentBuilder.setOpenAPIVersion()\` to silence this.`);
1743
+ return DEFAULT_OPENAPI_VERSION;
1744
+ }, "resolveOpenApiVersion");
1745
+
1718
1746
  // src/document/ref-titles.ts
1719
1747
  var applyRefTitles = /* @__PURE__ */ __name((doc) => {
1720
1748
  const schemas = doc.components?.schemas;
@@ -1867,7 +1895,6 @@ var withForcedExposure = /* @__PURE__ */ __name((collected, registry) => {
1867
1895
  classToDtoId: collected.classToDtoId
1868
1896
  };
1869
1897
  }, "withForcedExposure");
1870
- var OPENAPI_VERSION = "3.1.0";
1871
1898
  var applyZodNest = /* @__PURE__ */ __name((doc, opts = {}) => {
1872
1899
  const registry = opts.registry ?? defaultRegistry;
1873
1900
  const collected = collectUsage(doc, registry);
@@ -1908,7 +1935,7 @@ var applyZodNest = /* @__PURE__ */ __name((doc, opts = {}) => {
1908
1935
  doc,
1909
1936
  collected: extended
1910
1937
  });
1911
- doc.openapi = OPENAPI_VERSION;
1938
+ doc.openapi = resolveOpenApiVersion(doc);
1912
1939
  return doc;
1913
1940
  }, "applyZodNest");
1914
1941