Refs.js 826 B

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