public class JsonSchemaValidator extends Object
builder() to obtain a JsonSchemaValidator.Builder| Modifier and Type | Class and Description |
|---|---|
static class |
JsonSchemaValidator.Builder
An implementation of the builder design pattern to create
instances of
JsonSchemaValidator. |
| Modifier and Type | Method and Description |
|---|---|
static JsonSchemaValidator.Builder |
builder()
Returns a new
JsonSchemaValidator.Builder |
void |
validate(MuleEvent event)
Parses the
event's payload as a Json by the rules of
DefaultJsonParser.asJsonNode(Object). |
public static JsonSchemaValidator.Builder builder()
JsonSchemaValidator.BuilderJsonSchemaValidator.Builderpublic void validate(MuleEvent event) throws MuleException
event's payload as a Json by the rules of
DefaultJsonParser.asJsonNode(Object). Then it validates it
against the given schema.
If the validation fails, a JsonSchemaValidationException is thrown.
Notice that if the message payload is a Reader or InputStream
then it will be consumed in order to perform the validation. As a result,
the message payload will be changed to the String representation
of the json.event - the current MuleEventMuleExceptionCopyright © 2003–2021 MuleSoft, Inc.. All rights reserved.