zod-to-json-schema
Advanced tools
Comparing version 3.22.2 to 3.22.3
@@ -56,19 +56,6 @@ "use strict"; | ||
case "root": | ||
return { | ||
$ref: item.path.length === 0 | ||
? "" | ||
: item.path.length === 1 | ||
? `${item.path[0]}/` | ||
: item.path.join("/"), | ||
}; | ||
return { $ref: item.path.join("/") }; | ||
case "relative": | ||
return { $ref: getRelativePath(refs.currentPath, item.path) }; | ||
case "none": { | ||
if (item.path.length < refs.currentPath.length && | ||
item.path.every((value, index) => refs.currentPath[index] === value)) { | ||
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`); | ||
return {}; | ||
} | ||
return undefined; | ||
} | ||
case "none": | ||
case "seen": { | ||
@@ -80,5 +67,3 @@ if (item.path.length < refs.currentPath.length && | ||
} | ||
else { | ||
return item.jsonSchema; | ||
} | ||
return refs.$refStrategy === "seen" ? {} : undefined; | ||
} | ||
@@ -85,0 +70,0 @@ } |
@@ -52,19 +52,6 @@ import { ZodFirstPartyTypeKind } from "zod"; | ||
case "root": | ||
return { | ||
$ref: item.path.length === 0 | ||
? "" | ||
: item.path.length === 1 | ||
? `${item.path[0]}/` | ||
: item.path.join("/"), | ||
}; | ||
return { $ref: item.path.join("/") }; | ||
case "relative": | ||
return { $ref: getRelativePath(refs.currentPath, item.path) }; | ||
case "none": { | ||
if (item.path.length < refs.currentPath.length && | ||
item.path.every((value, index) => refs.currentPath[index] === value)) { | ||
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`); | ||
return {}; | ||
} | ||
return undefined; | ||
} | ||
case "none": | ||
case "seen": { | ||
@@ -76,5 +63,3 @@ if (item.path.length < refs.currentPath.length && | ||
} | ||
else { | ||
return item.jsonSchema; | ||
} | ||
return refs.$refStrategy === "seen" ? {} : undefined; | ||
} | ||
@@ -81,0 +66,0 @@ } |
{ | ||
"name": "zod-to-json-schema", | ||
"version": "3.22.2", | ||
"version": "3.22.3", | ||
"description": "Converts Zod schemas to Json Schemas", | ||
@@ -65,3 +65,3 @@ "types": "./dist/types/index.d.ts", | ||
"fast-diff": "^1.3.0", | ||
"json-schema-deref-sync": "^0.14.0", | ||
"local-ref-resolver": "^0.2.0", | ||
"rimraf": "^3.0.2", | ||
@@ -68,0 +68,0 @@ "tsx": "^4.1.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159712
2975