Add extra check to SchemaManager

This commit is contained in:
Roman Hotsiy 2015-12-14 15:53:22 +02:00
parent 5b32d31d13
commit 4af37bbd09

View File

@ -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;