xdmp.jsonValidateReportNode( node as Node, schema as Node, options as String[] ) as map:map
Validate a JSON node against a JSON Schema and return an error report.
xdmp.jsonValidateReportNode( { "count": 3, "items": [12] }, { "properties": { "count": { "type":"integer", "minimum":0 }, "items": { "type":"array", "items": {"type":"string", "minLength":1 } } } }) => {"errors":["XDMP-JSVALIDATEINVTYPE: Invalid node type: Expected node of type text, found number at NumberNode(12) using schema \"\"", "XDMP-JSVALIDATEINVNODE: Invalid node: Node NumberNode(12) not valid against property 'items' expected {type: string, minLength: 1} using schema \"\"", "XDMP-JSVALIDATEINVNODE: Invalid node: Node ObjectNode({\"count\":3, \"items\":[12]}) not valid against property 'properties' expected {properties: {count:{...}, items:{...}}} using schema \"\""]}
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.