From 5c19c7d470ea2853de7e40df8cfa0d89b3283516 Mon Sep 17 00:00:00 2001 From: tsamson Date: Thu, 11 Oct 2018 13:51:44 -0400 Subject: [PATCH] temporary solution for circular references in JSON without upgrading past 7.6 --- lib/paths.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/paths.js b/lib/paths.js index f34735b3..76a20c6b 100644 --- a/lib/paths.js +++ b/lib/paths.js @@ -378,7 +378,10 @@ internals.overload = function (base, priority) { */ internals.hasFileType = function (route) { - let routeString = JSON.stringify(route); + const routeString = JSON.stringify(route, (key, value) => { + // _currentJoi is a circular reference, introduced in Joi v11.0.0 + return key === '_currentJoi' ? undefined : value; + }); return routeString.indexOf('swaggerType') > -1; };