From 77675347b7e175097f1d7bb5e5c3b00c5c7c09a7 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Mon, 16 Oct 2023 15:14:53 +0530 Subject: [PATCH] fix( #1558): Discrepancy in `addUsedSchema` between v6 and v8 --- lib/compile/resolve.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compile/resolve.ts b/lib/compile/resolve.ts index 4360eab06..0cc742317 100644 --- a/lib/compile/resolve.ts +++ b/lib/compile/resolve.ts @@ -112,6 +112,7 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc // eslint-disable-next-line @typescript-eslint/unbound-method const _resolve = this.opts.uriResolver.resolve ref = normalizeId(baseId ? _resolve(baseId, ref) : ref) + if (this.opts.addUsedSchema === false) return ref // skip adding schema reference if (schemaRefs.has(ref)) throw ambiguos(ref) schemaRefs.add(ref) let schOrRef = this.refs[ref]