@scalar/fastify-api-reference 1.25.101 → 1.25.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18472,48 +18472,47 @@ function makeFilesystem(value, overwrites = {}) {
18472
18472
  }
18473
18473
  ];
18474
18474
  }
18475
- function resolveReferences(input, options, file, errors2) {
18476
- if (errors2 === void 0) {
18477
- errors2 = [];
18478
- }
18475
+ function resolveReferences(input, options, file, errors2 = []) {
18479
18476
  const clonedInput = structuredClone(input);
18480
18477
  const filesystem = makeFilesystem(clonedInput);
18481
18478
  const entrypoint = getEntrypoint(filesystem);
18482
- resolve2((file == null ? void 0 : file.specification) ?? entrypoint.specification, filesystem, file ?? entrypoint);
18479
+ const finalInput = (file == null ? void 0 : file.specification) ?? entrypoint.specification;
18480
+ dereference$1(finalInput, filesystem, file ?? entrypoint, /* @__PURE__ */ new WeakSet(), errors2, options);
18483
18481
  errors2 = errors2.filter((error2, index, self) => index === self.findIndex((t) => t.message === error2.message && t.code === error2.code));
18484
18482
  return {
18485
18483
  valid: errors2.length === 0,
18486
18484
  errors: errors2,
18487
- schema: (file ?? getEntrypoint(filesystem)).specification
18485
+ schema: finalInput
18488
18486
  };
18489
- function resolve2(schema2, resolveFilesystem, resolveFile, resolved = /* @__PURE__ */ new WeakSet()) {
18490
- var _a;
18491
- let result = { errors: [] };
18492
- if (schema2 === null || resolved.has(schema2))
18493
- return result;
18494
- resolved.add(schema2);
18495
- function resolveExternal(externalFile) {
18496
- resolve2(externalFile.specification, resolveFilesystem, externalFile, resolved);
18497
- return externalFile;
18498
- }
18499
- while (schema2.$ref !== void 0) {
18500
- const target = resolveUri(schema2.$ref, options, resolveFile, resolveFilesystem, resolveExternal, errors2);
18501
- if (typeof target !== "object" || target === null)
18502
- break;
18503
- (_a = options == null ? void 0 : options.onDereference) == null ? void 0 : _a.call(options, { schema: schema2, ref: schema2.$ref });
18504
- delete schema2.$ref;
18505
- for (const key of Object.keys(target)) {
18506
- if (schema2[key] === void 0) {
18507
- schema2[key] = target[key];
18508
- }
18487
+ }
18488
+ function dereference$1(schema2, filesystem, entrypoint, resolvedSchemas, errors2, options) {
18489
+ var _a;
18490
+ if (schema2 === null || resolvedSchemas.has(schema2))
18491
+ return;
18492
+ resolvedSchemas.add(schema2);
18493
+ function resolveExternal(externalFile) {
18494
+ dereference$1(externalFile.specification, filesystem, externalFile, resolvedSchemas, errors2, options);
18495
+ return externalFile;
18496
+ }
18497
+ while (schema2.$ref !== void 0) {
18498
+ const resolved = resolveUri(schema2.$ref, options, entrypoint, filesystem, resolveExternal, errors2);
18499
+ if (typeof resolved !== "object" || resolved === null)
18500
+ break;
18501
+ const dereferencedRef = schema2.$ref;
18502
+ delete schema2.$ref;
18503
+ for (const key of Object.keys(resolved)) {
18504
+ if (schema2[key] === void 0) {
18505
+ schema2[key] = resolved[key];
18509
18506
  }
18510
18507
  }
18511
- for (const value of Object.values(schema2)) {
18512
- if (typeof value === "object" && value !== null) {
18513
- result = resolve2(value, resolveFilesystem, resolveFile, resolved);
18514
- }
18508
+ if (dereferencedRef) {
18509
+ (_a = options == null ? void 0 : options.onDereference) == null ? void 0 : _a.call(options, { schema: schema2, ref: dereferencedRef });
18510
+ }
18511
+ }
18512
+ for (const value of Object.values(schema2)) {
18513
+ if (typeof value === "object" && value !== null) {
18514
+ dereference$1(value, filesystem, entrypoint, resolvedSchemas, errors2, options);
18515
18515
  }
18516
- return result;
18517
18516
  }
18518
18517
  }
18519
18518
  function resolveUri(uri2, options, file, filesystem, resolve2, errors2) {