Assert Valid JSON-Schema

This assertion is used to validate a JSON schema, based on the provided schema definition. Parameters:
Name Type/Value Required
Expression Expression Yes
JsonSchema JSON schema definition Yes
Assertion comment String No
Expression: Is the path to the element we want to operate on (ex: payload.ProductID). See Expression for more details. JsonSchema: The JSON schema definition. This will be used to validate the JSON passed in the expression field. Example:
Sample JSON: { "rectangle": { "a": 15, "b": 5 } } Sample Schema: { "type" : "object", "properties" : { "rectangle" : {"$ref" : "#/definitions/Rectangle" } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }
Code View Example:
<set var="json_success" lang="template"> <![CDATA[{ "rectangle" : { "a" : 15, "b" : 5 } }]]> </set> <assert-valid-jsonschema expression="json_success"> <![CDATA[{ "type" : "object", "properties" : { "rectangle" : {"$ref" : "#/definitions/Rectangle" } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }]]> </assert-valid-jsonschema>