JSON Validator
Usage
The JSON Validator checks a JSON input message for validity against a JSON schema specified in https://json-schema.org/specification.
The schema can be stored in the JSON Validator or referenced via a URI.
If the input message is valid, it is passed as output message to the subsequent module of the JSON Validator.
Otherwise, the output message contains a Validation section with error messages and an element OriginalDocument with the original input message.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<Validation>
<Errors>
<Error>
<ErrorInfo infoKey="level">"warning"</ErrorInfo>
<ErrorInfo infoKey="schema">
{"loadingURI":"#","pointer":"/definitions/elements/items"}
</ErrorInfo>
<ErrorInfo infoKey="domain">"syntax"</ErrorInfo>
<ErrorInfo infoKey="message">"the following keywords are unknown and will be ignored:
[ref]"
</ErrorInfo>
<ErrorInfo infoKey="ignored">["ref"]</ErrorInfo>
</Error>
<Error>
<ErrorInfo infoKey="level">"warning"</ErrorInfo>
<ErrorInfo infoKey="schema">
{"loadingURI":"#","pointer":"/properties/attributes/type"}
</ErrorInfo>
<ErrorInfo infoKey="domain">"syntax"</ErrorInfo>
<ErrorInfo infoKey="message">"the following keywords are unknown and will be ignored:
[const]"
</ErrorInfo>
<ErrorInfo infoKey="ignored">["const"]</ErrorInfo>
</Error>
</Errors>
<OriginalDocument>
<![CDATA[{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
...
}]]>
</OriginalDocument>
</Validation>
You can use the error branch to handle validation errors, refer to Using Modules as Error Branches.
Performance
Depending on the size of the JSON schema and the location where this file is accessible, the JSON Validator module can negatively impact the performance of the INUBIT Process Engine.
To minimize this impact, you should always store the schema locally in the module rather than referencing it via a URI.