From c5e38d7f48e2b5d6ce5ea70f7337f983e55969d6 Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Thu, 9 Apr 2015 01:58:01 -0400 Subject: Add captioned-image-list type --- app/node_modules/okschema/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'app/node_modules') diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js index 4e8ea73..0544c79 100644 --- a/app/node_modules/okschema/index.js +++ b/app/node_modules/okschema/index.js @@ -34,6 +34,33 @@ var types = { }]; } } + }, + 'captioned-image-list': { + parent: [{ + uri: { type: 'string' }, // TODO Implement URI type + caption: { type: 'string' } + }], + assertValid: function(spec, value) { + var message; + var actual; + if (!value || !value.length) { + throw [{ + message: 'Not an array', + expected: JSON.stringify(this.parent), + actual: value + }]; + } else { + value.forEach(function(obj) { + if (!(obj.uri && obj.caption)) { + throw [{ + message: 'Array contains invalid object', + expected: JSON.stringify(this.parent), + actual: obj + }]; + } + }); + } + } } } -- cgit v1.2.3-70-g09d2