diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/node_modules/okschema/index.js | 27 |
1 files changed, 27 insertions, 0 deletions
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 + }]; + } + }); + } + } } } |
