/**
* @module de.stschnell
*
* @version 0.1.0
*
* @outputType boolean
*
* @name jsonSchemaValidatorCheck
*/
var jsonContent = '{"name": "Ashley", "age": 25}'
var jsonSchema = '{ \
"definitions": {}, \
"$schema": "http://json-schema.org/draft-07/schema#", \
"$id": "http://example.com/root.json", \
"type": "object", \
"title": "The Root Schema", \
"required": [ \
"name", \
"age" \
], \
"properties": { \
"name": { \
"$id": "#/properties/name", \
"type": "string", \
"title": "The Name Schema", \
"default": "", \
"examples": [ \
"Ashley" \
], \
"pattern": "^(.*)$" \
}, \
"age": { \
"$id": "#/properties/age", \
"type": "integer", \
"title": "The Age Schema", \
"default": 0, \
"examples": [ \
25 \
] \
} \
} \
}'
var result = System.getModule("de.stschnell").jsonSchemaValidator(
jsonContent,
jsonSchema
)
return result.result
|