Package com.networknt.schema.keyword
Class OneOfValidator
- java.lang.Object
-
- com.networknt.schema.keyword.AbstractKeywordValidator
-
- com.networknt.schema.keyword.BaseKeywordValidator
-
- com.networknt.schema.keyword.OneOfValidator
-
- All Implemented Interfaces:
KeywordValidator,Validator,Walker
public class OneOfValidator extends BaseKeywordValidator
KeywordValidatorfor oneOf.
-
-
Field Summary
-
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 OneOfValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanShortCircuit(ExecutionContext executionContext)voidpreloadSchema()In case theKeywordValidatorhas a relatedSchemaor several ones, calling preloadSchema will actually load the schema document(s) eagerly.protected booleanreportChildErrors(ExecutionContext executionContext)Determines if child errors should be reported.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 voidvalidate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation, boolean walk)voidwalk(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation, boolean shouldValidateSchema)This is default implementation of walk method.-
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
-
-
-
-
Constructor Detail
-
OneOfValidator
public OneOfValidator(SchemaLocation schemaLocation, com.fasterxml.jackson.databind.JsonNode schemaNode, Schema parentSchema, SchemaContext schemaContext)
-
-
Method Detail
-
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.- Parameters:
executionContext- the execution contextnode- the instance node being processedrootNode- the instance document that the instance node belongs toinstanceLocation- the location of the instance node being processed
-
validate
protected void validate(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation, boolean walk)
-
reportChildErrors
protected boolean reportChildErrors(ExecutionContext executionContext)
Determines if child errors should be reported.- Parameters:
executionContext- the execution context- Returns:
- true if child errors should be reported
-
canShortCircuit
protected boolean canShortCircuit(ExecutionContext executionContext)
-
walk
public void walk(ExecutionContext executionContext, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, NodePath instanceLocation, boolean shouldValidateSchema)
Description copied from interface:ValidatorThis is default implementation of walk method. Its job is to call the validate method if shouldValidateSchema is enabled.- Parameters:
executionContext- the execution contextnode- the instance node being processedrootNode- the instance document that the instance node belongs toinstanceLocation- the location of the instance node being processedshouldValidateSchema- true to validate the schema while walking
-
preloadSchema
public void preloadSchema()
Description copied from interface:KeywordValidatorIn case theKeywordValidatorhas a relatedSchemaor several ones, calling preloadSchema will actually load the schema document(s) eagerly.
-
-