Package com.networknt.schema.keyword
Class FormatValidator
java.lang.Object
com.networknt.schema.keyword.AbstractKeywordValidator
com.networknt.schema.keyword.BaseKeywordValidator
com.networknt.schema.format.BaseFormatValidator
com.networknt.schema.keyword.FormatValidator
- All Implemented Interfaces:
KeywordValidator,Validator,Walker
Validator for Format.
-
Field Summary
Fields inherited from class com.networknt.schema.format.BaseFormatValidator
assertionsEnabledFields inherited from class com.networknt.schema.keyword.BaseKeywordValidator
errorMessage, parentSchema, schemaContextFields inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
schemaLocation, schemaNode -
Constructor Summary
ConstructorsConstructorDescriptionFormatValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext, Format format, Keyword keyword) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancreateUnknownFormatAssertions(ExecutionContext executionContext) When the Format-Assertion vocabulary is specified, implementations MUST fail upon encountering unknown formats.protected ObjectGets the annotation value.protected booleanisStrict(ExecutionContext executionContext) Determines if strict handling.voidvalidate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) Validate the instance node which belongs to the instance document at the instance location.protected voidvalidateUnknownFormat(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) When the Format-Assertion vocabulary is specified, implementations MUST fail upon encountering unknown formats.Methods inherited from class com.networknt.schema.format.BaseFormatValidator
isAssertionsEnabled, isFormatAssertionVocabularyEnabled, isFormatAssertionVocabularyEnabledMethods inherited from class com.networknt.schema.keyword.BaseKeywordValidator
error, getNodeFieldType, getParentSchema, preloadSchemasMethods inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
collectAnnotations, collectAnnotations, getKeyword, getSchemaLocation, getSchemaNode, hasAdjacentKeywordInEvaluationPath, hasUnevaluatedItemsInEvaluationPath, hasUnevaluatedPropertiesInEvaluationPath, putAnnotation, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.networknt.schema.keyword.KeywordValidator
getKeyword, preloadSchemaMethods inherited from interface com.networknt.schema.Validator
getSchemaLocation, walk
-
Constructor Details
-
FormatValidator
public FormatValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext, Format format, Keyword keyword)
-
-
Method Details
-
getAnnotationValue
Gets the annotation value.- Returns:
- the annotation value
-
validate
public void validate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) Description copied from interface:ValidatorValidate the instance node which belongs to the instance document at the instance location. -
validateUnknownFormat
protected void validateUnknownFormat(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation) When the Format-Assertion vocabulary is specified, implementations MUST fail upon encountering unknown formats.- Parameters:
executionContext- the execution contextnode- the noderootNode- the root nodeinstanceLocation- the instance location
-
createUnknownFormatAssertions
When the Format-Assertion vocabulary is specified, implementations MUST fail upon encountering unknown formats.Note that this is different from setting the setFormatAssertionsEnabled configuration option.
The following logic will return true if the format assertions option is turned on and strict is enabled (default false) or the format assertion vocabulary is enabled.
- Parameters:
executionContext- the execution context- Returns:
- true if format assertions should be generated
-
isStrict
Determines if strict handling.Note that this defaults to false.
- Parameters:
executionContext- the execution context- Returns:
- whether to perform strict handling
-