From 588197e114d9a8ef67dd78181cfa05e48e4de742 Mon Sep 17 00:00:00 2001 From: JonLuca DeCaro Date: Thu, 10 Oct 2024 12:36:35 -0700 Subject: [PATCH] fix: dont cache on circular references to prevent overwriting external ref resolutions --- lib/dereference.ts | 2 +- .../dereference-callback/dereference-callback.spec.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/dereference.ts b/lib/dereference.ts index 63a42ab1..b56b58bb 100644 --- a/lib/dereference.ts +++ b/lib/dereference.ts @@ -190,7 +190,7 @@ function dereference$Ref 1) { const extraKeys = {}; diff --git a/test/specs/dereference-callback/dereference-callback.spec.ts b/test/specs/dereference-callback/dereference-callback.spec.ts index 4f4979c9..03d26522 100644 --- a/test/specs/dereference-callback/dereference-callback.spec.ts +++ b/test/specs/dereference-callback/dereference-callback.spec.ts @@ -22,26 +22,26 @@ describe("Schema with a $ref", () => { expect(calls).to.deep.equal([ { path: "#/definitions/b", - value: { $ref: "#/definitions/a" }, + value: { $ref: "#/definitions/b" }, parent: { a: { - $ref: "#/definitions/a", + $ref: "#/definitions/b", }, b: { - $ref: "#/definitions/a", + $ref: "#/definitions/b", }, }, parentPropName: "a", }, { path: "#/definitions/a", - value: { $ref: "#/definitions/a" }, + value: { $ref: "#/definitions/b" }, parent: { c: { type: "string", }, d: { - $ref: "#/definitions/a", + $ref: "#/definitions/b", }, }, parentPropName: "d",