Package com.networknt.schema
Class BaseJsonValidator
- java.lang.Object
-
- com.networknt.schema.BaseJsonValidator
-
- All Implemented Interfaces:
JsonValidator
- Direct Known Subclasses:
AdditionalPropertiesValidator
,AllOfValidator
,AnyOfValidator
,DependenciesValidator
,EnumValidator
,FormatValidator
,ItemsValidator
,JsonSchema
,MaximumValidator
,MaxItemsValidator
,MaxLengthValidator
,MaxPropertiesValidator
,MinimumValidator
,MinItemsValidator
,MinLengthValidator
,MinPropertiesValidator
,MultipleOfValidator
,NotAllowedValidator
,NotValidator
,OneOfValidator
,PatternPropertiesValidator
,PatternValidator
,PropertiesValidator
,ReadOnlyValidator
,RefValidator
,RequiredValidator
,TypeValidator
,UnionTypeValidator
,UniqueItemsValidator
public abstract class BaseJsonValidator extends Object implements JsonValidator
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaValidatorsConfig
config
SchemaValidatorsConfig can only get and set in validationContext-
Fields inherited from interface com.networknt.schema.JsonValidator
AT_ROOT
-
-
Constructor Summary
Constructors Constructor Description BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, boolean suppressSubSchemaRetrieval)
BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, ValidationContext validationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 boolean
equals(double n1, double n2)
protected JsonSchema
fetchSubSchemaNode(ValidationContext validationContext)
protected String
getNodeFieldType()
protected JsonSchema
getParentSchema()
com.fasterxml.jackson.databind.JsonNode
getSchemaNode()
protected String
getSchemaPath()
protected ValidatorTypeCode
getValidatorType()
protected boolean
greaterThan(double n1, double n2)
protected boolean
lessThan(double n1, double n2)
protected void
parseErrorCode(String errorCodeKey)
Set<ValidationMessage>
validate(com.fasterxml.jackson.databind.JsonNode node)
Validate the given root JsonNode, starting at the root of the data path.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.networknt.schema.JsonValidator
validate
-
-
-
-
Field Detail
-
config
protected SchemaValidatorsConfig config
SchemaValidatorsConfig can only get and set in validationContext
-
-
Constructor Detail
-
BaseJsonValidator
public BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, ValidationContext validationContext)
-
BaseJsonValidator
public BaseJsonValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidatorTypeCode validatorType, boolean suppressSubSchemaRetrieval)
-
-
Method Detail
-
getSchemaPath
protected String getSchemaPath()
-
getSchemaNode
public com.fasterxml.jackson.databind.JsonNode getSchemaNode()
-
getParentSchema
protected JsonSchema getParentSchema()
-
fetchSubSchemaNode
protected JsonSchema fetchSubSchemaNode(ValidationContext validationContext)
-
validate
public Set<ValidationMessage> validate(com.fasterxml.jackson.databind.JsonNode node)
Description copied from interface:JsonValidator
Validate the given root JsonNode, starting at the root of the data path.- Specified by:
validate
in interfaceJsonValidator
- Parameters:
node
- JsonNode- Returns:
- A list of ValidationMessage if there is any validation error, or an empty list if there is no error.
-
equals
protected boolean equals(double n1, double n2)
-
greaterThan
protected boolean greaterThan(double n1, double n2)
-
lessThan
protected boolean lessThan(double n1, double n2)
-
parseErrorCode
protected void parseErrorCode(String errorCodeKey)
-
buildValidationMessage
protected ValidationMessage buildValidationMessage(String at, String... arguments)
-
debug
protected void debug(org.slf4j.Logger logger, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, String at)
-
getValidatorType
protected ValidatorTypeCode getValidatorType()
-
getNodeFieldType
protected String getNodeFieldType()
-
-