summaryrefslogtreecommitdiff
path: root/app/node_modules
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-09 01:58:01 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-09 01:58:01 -0400
commitc5e38d7f48e2b5d6ce5ea70f7337f983e55969d6 (patch)
tree4615fb1e73776647b08838d7b5b41cd445a57b1e /app/node_modules
parent0f7c28fa2e1fec6b3ce006435cd4bd6c7725d4af (diff)
Add captioned-image-list type
Diffstat (limited to 'app/node_modules')
-rw-r--r--app/node_modules/okschema/index.js27
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
+ }];
+ }
+ });
+ }
+ }
}
}