Refs.mjs 932 B

123456789101112131415161718192021222324
  1. import { getDefaultOptions } from "./Options.mjs";
  2. import { zodDef } from "./util.mjs";
  3. export const getRefs = (options) => {
  4. const _options = getDefaultOptions(options);
  5. const currentPath = _options.name !== undefined ?
  6. [..._options.basePath, _options.definitionPath, _options.name]
  7. : _options.basePath;
  8. return {
  9. ..._options,
  10. currentPath: currentPath,
  11. propertyPath: undefined,
  12. seenRefs: new Set(),
  13. seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
  14. zodDef(def),
  15. {
  16. def: zodDef(def),
  17. path: [..._options.basePath, _options.definitionPath, name],
  18. // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
  19. jsonSchema: undefined,
  20. },
  21. ])),
  22. };
  23. };
  24. //# sourceMappingURL=Refs.mjs.map