full site update
This commit is contained in:
14
node_modules/zod-to-json-schema/dist/esm/parseDef.js
generated
vendored
14
node_modules/zod-to-json-schema/dist/esm/parseDef.js
generated
vendored
@@ -1,5 +1,7 @@
|
||||
import { ignoreOverride } from "./Options.js";
|
||||
import { selectParser } from "./selectParser.js";
|
||||
import { getRelativePath } from "./getRelativePath.js";
|
||||
import { parseAnyDef } from "./parsers/any.js";
|
||||
export function parseDef(def, refs, forceResolution = false) {
|
||||
const seenItem = refs.seen.get(def);
|
||||
if (refs.override) {
|
||||
@@ -43,20 +45,12 @@ const get$ref = (item, refs) => {
|
||||
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 parseAnyDef(refs);
|
||||
}
|
||||
return refs.$refStrategy === "seen" ? {} : undefined;
|
||||
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
const getRelativePath = (pathA, pathB) => {
|
||||
let i = 0;
|
||||
for (; i < pathA.length && i < pathB.length; i++) {
|
||||
if (pathA[i] !== pathB[i])
|
||||
break;
|
||||
}
|
||||
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
||||
};
|
||||
const addMeta = (def, refs, jsonSchema) => {
|
||||
if (def.description) {
|
||||
jsonSchema.description = def.description;
|
||||
|
Reference in New Issue
Block a user