Validates request and response message bodies against a schema. The schema type is selected by the attribute you set:
wsdl for SOAP messages,
schema for XML against an XSD,
jsonSchema for JSON or YAML, or
schematron. Exactly one of them must be configured; inside a soapProxy the WSDL is taken from the proxy automatically. An empty body passes; an invalid body is rejected, either with a detailed error response or a generic one plus a log entry, depending on
failureHandler. See the examples under examples/validation, examples/xml/xml-validation, and examples/web-services-soap/soap-wsdl-validation.
validator:
wsdl: <url> | schema: <url> | jsonSchema: <url> | schematron: <url> # choose one
[ failureHandler: response | log ] # default: response
Example Configuration Copy api : port : 2000 flow : - validator : jsonSchema : schema.json target : url : https: //api.predic8.de
api:
port: 2000
flow:
- validator:
jsonSchema: schema.json
target:
url: https://api.predic8.de
Syntax Copy validator : '$ref' : <string> failureHandler : <string> jsonSchema : <string> schema : <string> schemaMappings : { } schematron : <string> schemaVersion : <string> serviceName : <string> skipFaults : <boolean> wsdl : <string>
validator:
'$ref': <string>
failureHandler: <string>
jsonSchema: <string>
schema: <string>
schemaMappings: {}
schematron: <string>
schemaVersion: <string>
serviceName: <string>
skipFaults: <boolean>
wsdl: <string>
Attributes Name Required Default Description Examples $ref false - Reference a component defined under components . - failureHandler false response How a validation failure is reported. response returns a detailed error to the client; log returns a generic error and writes the details to the log. log jsonSchema false - JSON Schema (URL or file) to validate JSON or YAML message bodies against. schema2000.json schema false - XSD schema (URL or file) to validate XML message bodies against. http://www.predic8.com/schemas/order.xsd schematron false - Schematron schema (URL or file) to validate XML message bodies against. car-schematron.xml schemaVersion false 2020-12 JSON Schema draft to validate against. Applies only to jsonSchema. 04, 05, 06, 07, 2019-09, 2020-12 serviceName false - Name of a service element in the WSDL. When set, messages are validated against that service only. ArticleService skipFaults false false Whether to skip validation of SOAP fault messages. Only valid together with wsdl. - wsdl false - WSDL (URL or file) to validate SOAP request and response messages against. http://predic8.com/material/ArticleService?wsdl
Child Structure Can be used in