Refs.js 880 B

12345678910111213141516171819202122
  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. flags: { hasReferencedOpenAiAnyType: false },
  10. currentPath: currentPath,
  11. propertyPath: undefined,
  12. seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
  13. def._def,
  14. {
  15. def: def._def,
  16. path: [..._options.basePath, _options.definitionPath, name],
  17. // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
  18. jsonSchema: undefined,
  19. },
  20. ])),
  21. };
  22. };