From b657ae3b37e634fd437dd08b63473d09577b9ec9 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Sun, 28 Aug 2016 17:58:04 +0100 Subject: [PATCH] Workaround for OpenAPI / Swagger v2 schema validation --- lib/schemaRegistry.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/schemaRegistry.js b/lib/schemaRegistry.js index 6e3f0b0..77180f2 100644 --- a/lib/schemaRegistry.js +++ b/lib/schemaRegistry.js @@ -104,7 +104,10 @@ SchemaRegistry._gatherRefs = function(obj) { do { if (Object.prototype.hasOwnProperty.call(currentObj, '$ref')) { - result.push(currentObj.$ref); + var currentObjRef = currentObj.$ref; + if ( typeof currentObjRef === "string" ) { + result.push(currentObj.$ref); + } } var keys = Object.keys(currentObj);