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 |
Event |
validate(Event event,
MuleContext muleContext)
Parses the
event's payload as a Json by the rules of DefaultJsonParser.asJsonNode(Object). |
public static JsonSchemaValidator.Builder builder()
JsonSchemaValidator.BuilderJsonSchemaValidator.Builderpublic Event validate(Event event, MuleContext muleContext) throws org.mule.runtime.api.exception.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 EventmuleContext - the Mule node.org.mule.runtime.api.exception.MuleExceptionCopyright © 2003–2016 MuleSoft, Inc.. All rights reserved.