From dd1f7f649d3e918e8573d1c9741178cc79195c1d Mon Sep 17 00:00:00 2001 From: Lars Trieloff Date: Mon, 13 Jan 2020 14:52:31 +0100 Subject: [PATCH] fix(loader): guard against endless wrapping The schema loader would wrap objects that have already been wrapped again. This was especially an issue with recursive references, where it could lead to endless loops. fixes #194 --- lib/schemaProxy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/schemaProxy.js b/lib/schemaProxy.js index 0cc5356a..f2de9f0d 100644 --- a/lib/schemaProxy.js +++ b/lib/schemaProxy.js @@ -112,6 +112,9 @@ const handler = ({ } else { console.error('cannot resolve', basedoc); } + } else if (retval[symbols.filename]) { + // console.log('I am in a loop!'); + return retval; } // console.log('making new proxy from', target, prop, 'receiver', receiver[symbols.id]);