aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js
new file mode 100644
index 00000000..f70f4dfb
--- /dev/null
+++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/is-my-json-valid/example.js
@@ -0,0 +1,18 @@
+var validator = require('./')
+
+var validate = validator({
+ type: 'object',
+ properties: {
+ hello: {
+ required: true,
+ type: 'string'
+ }
+ }
+})
+
+console.log('should be valid', validate({hello: 'world'}))
+console.log('should not be valid', validate({}))
+
+// get the last error message by checking validate.error
+// the following will print "data.hello is required"
+console.log('the errors were:', validate.errors)