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
public class FormatValidator extends BaseFormatValidator implements KeywordValidator
Validator for Format.
-
-
Field Summary
-
Fields inherited from class com.networknt.schema.format.BaseFormatValidator
assertionsEnabled
-
Fields inherited from class com.networknt.schema.keyword.BaseKeywordValidator
errorMessage, parentSchema, schemaContext
-
Fields inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
schemaLocation, schemaNode
-
-
Constructor Summary
Constructors Constructor Description FormatValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext, Format format, Keyword keyword)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancreateUnknownFormatAssertions(ExecutionContext executionContext)When the Format-Assertion vocabulary is specified, implementations MUST fail upon encountering unknown formats.protected ObjectgetAnnotationValue()Gets 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, isFormatAssertionVocabularyEnabled
-
Methods inherited from class com.networknt.schema.keyword.BaseKeywordValidator
error, getNodeFieldType, getParentSchema, preloadSchemas
-
Methods inherited from class com.networknt.schema.keyword.AbstractKeywordValidator
collectAnnotations, collectAnnotations, getKeyword, getSchemaLocation, getSchemaNode, hasAdjacentKeywordInEvaluationPath, hasUnevaluatedItemsInEvaluationPath, hasUnevaluatedPropertiesInEvaluationPath, putAnnotation, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.networknt.schema.keyword.KeywordValidator
getKeyword, preloadSchema
-
Methods inherited from interface com.networknt.schema.Validator
getSchemaLocation, walk
-
-
-
-
Constructor Detail
-
FormatValidator
public FormatValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext, Format format, Keyword keyword)
-
-
Method Detail
-
getAnnotationValue
protected Object 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
protected boolean createUnknownFormatAssertions(ExecutionContext executionContext)
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
protected boolean isStrict(ExecutionContext executionContext)
Determines if strict handling.Note that this defaults to false.
- Parameters:
executionContext- the execution context- Returns:
- whether to perform strict handling
-
-