From 99ca1cb41fa651a30315509fce10d36c351697a9 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Wed, 11 Mar 2015 11:06:43 +0100 Subject: [PATCH] Allow manifest validation types to be arrays. --- js/server/modules/org/arangodb/foxx/manager.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/manager.js b/js/server/modules/org/arangodb/foxx/manager.js index 7c1007b2d6..a72a58e82f 100644 --- a/js/server/modules/org/arangodb/foxx/manager.js +++ b/js/server/modules/org/arangodb/foxx/manager.js @@ -219,7 +219,7 @@ "thumbnail": [ false, "string" ], "version": [ true, "string" ], "rootElement": [ false, "boolean" ], - "exports": [ false, "object" ] + "exports": [ false, ["object", "string"] ] }; var att, failed = false; @@ -232,11 +232,15 @@ expectedType = expected[att][1]; actualType = Array.isArray(mf[att]) ? "array" : typeof(mf[att]); - if (actualType !== expectedType) { + function matchesType(type) { + return actualType === type; + } + + if (!(Array.isArray(expectedType) ? expectedType.some(matchesType) : actualType === expectedType)) { console.error("Manifest '%s' uses an invalid data type (%s) for %s attribute '%s'", filename, actualType, - expectedType, + String(expectedType), att); failed = true; }