public static final class JsonSchemaValidator.Builder extends Object
JsonSchemaValidator.
This builder can be safely reused, returning a different
instance each time build() is invoked.
It is mandatory to invoke with a valid value one of the methods that allow setting a value for the schema to be validated against
setSchemaLocation(String) or setSchemaContent(String)
before attempting to build() an instance| Modifier and Type | Method and Description |
|---|---|
JsonSchemaValidator.Builder |
addSchemaRedirect(String from,
String to)
Allows to redirect any given URI in the Schema (or even the schema location itself)
to any other specific URI.
|
JsonSchemaValidator.Builder |
addSchemaRedirects(Map<String,String> redirects)
Allows adding many redirects following the same rules as
addSchemaRedirect(String, String) |
JsonSchemaValidator.Builder |
allowArbitraryPrecision(boolean allowArbitraryPrecision)
Determines whether the validator use arbitrary precision when reading floating points values.
|
JsonSchemaValidator.Builder |
allowDuplicateKeys(boolean allowDuplicateKeys)
Determines whether the validator should fail when the document contains duplicate keys.
|
JsonSchemaValidator |
build()
Builds a new instance per the given configuration.
|
JsonSchemaValidator.Builder |
setDereferencing(JsonSchemaDereferencingMode dereferencing)
Sets the dereferencing mode to be used.
|
JsonSchemaValidator.Builder |
setSchemaContent(String schemaContent) |
JsonSchemaValidator.Builder |
setSchemaLocation(String schemaLocation)
A location in which the json schema is present.
|
public JsonSchemaValidator.Builder setSchemaLocation(String schemaLocation)
schemaLocation - the location of the schema to validate againstpublic JsonSchemaValidator.Builder setDereferencing(JsonSchemaDereferencingMode dereferencing)
JsonSchemaDereferencingMode.CANONICALdereferencing - a dereferencing modeIllegalArgumentException - if dereferencing is nullpublic JsonSchemaValidator.Builder allowDuplicateKeys(boolean allowDuplicateKeys)
allowDuplicateKeys: - if true, the validator will allow duplicate keys, otherwise it will fail.public JsonSchemaValidator.Builder allowArbitraryPrecision(boolean allowArbitraryPrecision)
allowArbitraryPrecision: - if true, the validator will use arbitrary precision for floating point values.public JsonSchemaValidator.Builder addSchemaRedirect(String from, String to)
from - the location to redirect. Accepts the same formats as setSchemaLocation(String)to - the location to redirect to. Accepts the same formats as setSchemaLocation(String)IllegalArgumentException - if from or to are blank or nullpublic JsonSchemaValidator.Builder addSchemaRedirects(Map<String,String> redirects)
addSchemaRedirect(String, String)redirects - a Map with redirectionsIllegalArgumentException - if redirects is nullpublic JsonSchemaValidator.Builder setSchemaContent(String schemaContent)
schemaContent - the content of the schema against which it is validatedpublic JsonSchemaValidator build()
schemaLocation and schemaContent.
Only one is allowed at a time, you cannot use both at the same time.JsonSchemaValidatororg.mule.runtime.extension.api.exception.ModuleExceptionorg.mule.runtime.api.exception.MuleRuntimeExceptionCopyright © 2026 MuleSoft, Inc.. All rights reserved.