From 4af37bbd09073c32f8f6639072f9cc6b8f782084 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 14 Dec 2015 15:53:22 +0200 Subject: [PATCH] Add extra check to SchemaManager --- lib/utils/SchemaManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/SchemaManager.js b/lib/utils/SchemaManager.js index 7071483b..856a43d7 100644 --- a/lib/utils/SchemaManager.js +++ b/lib/utils/SchemaManager.js @@ -71,7 +71,9 @@ export default class SchemaManager { getMethodParams(methodPtr, resolveRefs) { /* inject JsonPointer into array elements */ function injectPointers(array, root) { - if (!array) return array; + if (!Array.isArray(array)) { + throw new Error(`parameters must be an array. Got ${typeof array} at ${root}`); + } return array.map((element, idx) => { element._pointer = JsonPointer.join(root, idx); return element;