public abstract class BaseJsonValidator extends Object implements JsonValidator
Modifier and Type | Field and Description |
---|---|
protected SchemaValidatorsConfig |
config
SchemaValidatorsConfig can only get and set in validationContext
|
protected boolean |
failFast |
protected JsonSchema |
parentSchema |
protected com.fasterxml.jackson.databind.JsonNode |
schemaNode |
protected String |
schemaPath |
AT_ROOT
Constructor and Description |
---|
BaseJsonValidator(String schemaPath,
com.fasterxml.jackson.databind.JsonNode schemaNode,
JsonSchema parentSchema,
ValidatorTypeCode validatorType,
boolean suppressSubSchemaRetrieval,
boolean failFast) |
BaseJsonValidator(String schemaPath,
com.fasterxml.jackson.databind.JsonNode schemaNode,
JsonSchema parentSchema,
ValidatorTypeCode validatorType,
ValidationContext validationContext) |
Modifier and Type | Method and Description |
---|---|
protected ValidationMessage |
buildValidationMessage(String at,
String... arguments) |
protected static void |
checkDiscriminatorMatch(ValidationContext.DiscriminatorContext currentDiscriminatorContext,
com.fasterxml.jackson.databind.node.ObjectNode discriminator,
String discriminatorPropertyValue,
JsonSchema jsonSchema)
Checks based on the current
ValidationContext.DiscriminatorContext whether the provided JsonSchema a match against
against the current discriminator. |
protected void |
debug(org.slf4j.Logger logger,
com.fasterxml.jackson.databind.JsonNode node,
com.fasterxml.jackson.databind.JsonNode rootNode,
String at) |
protected boolean |
equals(double n1,
double n2) |
protected JsonSchema |
fetchSubSchemaNode(ValidationContext validationContext) |
protected String |
getNodeFieldType() |
JsonSchema |
getParentSchema() |
com.fasterxml.jackson.databind.JsonNode |
getSchemaNode() |
String |
getSchemaPath() |
protected ValidatorTypeCode |
getValidatorType() |
protected boolean |
greaterThan(double n1,
double n2) |
protected boolean |
isPartOfOneOfMultipleType() |
protected boolean |
lessThan(double n1,
double n2) |
protected void |
parseErrorCode(String errorCodeKey) |
protected static void |
registerAndMergeDiscriminator(ValidationContext.DiscriminatorContext currentDiscriminatorContext,
com.fasterxml.jackson.databind.node.ObjectNode discriminator,
JsonSchema schema,
String at)
Rolls up all nested and compatible discriminators to the root discriminator of the type.
|
Set<ValidationMessage> |
validate(com.fasterxml.jackson.databind.JsonNode node)
Validate the given root JsonNode, starting at the root of the data path.
|
Set<ValidationMessage> |
walk(com.fasterxml.jackson.databind.JsonNode node,
com.fasterxml.jackson.databind.JsonNode rootNode,
String at,
boolean shouldValidateSchema)
This is default implementation of walk method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validate
protected String schemaPath
protected com.fasterxml.jackson.databind.JsonNode schemaNode
protected JsonSchema parentSchema
protected SchemaValidatorsConfig config
protected final boolean failFast
public BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, ValidationContext validationContext)
public BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, boolean suppressSubSchemaRetrieval, boolean failFast)
public String getSchemaPath()
public com.fasterxml.jackson.databind.JsonNode getSchemaNode()
public JsonSchema getParentSchema()
protected JsonSchema fetchSubSchemaNode(ValidationContext validationContext)
public Set<ValidationMessage> validate(com.fasterxml.jackson.databind.JsonNode node)
JsonValidator
validate
in interface JsonValidator
node
- JsonNodeprotected boolean equals(double n1, double n2)
protected boolean greaterThan(double n1, double n2)
protected boolean lessThan(double n1, double n2)
protected void parseErrorCode(String errorCodeKey)
protected ValidationMessage buildValidationMessage(String at, String... arguments)
protected void debug(org.slf4j.Logger logger, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, String at)
protected ValidatorTypeCode getValidatorType()
protected String getNodeFieldType()
public Set<ValidationMessage> walk(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, String at, boolean shouldValidateSchema)
walk
in interface JsonSchemaWalker
node
- JsonNoderootNode
- JsonNodeat
- StringshouldValidateSchema
- booleanprotected boolean isPartOfOneOfMultipleType()
protected static void checkDiscriminatorMatch(ValidationContext.DiscriminatorContext currentDiscriminatorContext, com.fasterxml.jackson.databind.node.ObjectNode discriminator, String discriminatorPropertyValue, JsonSchema jsonSchema)
ValidationContext.DiscriminatorContext
whether the provided JsonSchema
a match against
against the current discriminator.currentDiscriminatorContext
- the currently active ValidationContext.DiscriminatorContext
discriminator
- the discriminator to use for the checkdiscriminatorPropertyValue
- the value of the discriminator/propertyName
fieldjsonSchema
- the JsonSchema
to checkprotected static void registerAndMergeDiscriminator(ValidationContext.DiscriminatorContext currentDiscriminatorContext, com.fasterxml.jackson.databind.node.ObjectNode discriminator, JsonSchema schema, String at)
propertyName
or mappings.currentDiscriminatorContext
- the currently active ValidationContext.DiscriminatorContext
discriminator
- the discriminator to use for the checkschema
- the value of the discriminator/propertyName
fieldat
- the logging prefixCopyright © 2021. All rights reserved.