public class JsonSchema extends BaseJsonValidator
config, failFast, parentSchema, schemaNode, schemaPath
AT_ROOT
Constructor and Description |
---|
JsonSchema(ValidationContext validationContext,
String schemaPath,
URI currentUri,
com.fasterxml.jackson.databind.JsonNode schemaNode,
JsonSchema parent) |
JsonSchema(ValidationContext validationContext,
URI baseUri,
com.fasterxml.jackson.databind.JsonNode schemaNode) |
JsonSchema(ValidationContext validationContext,
URI baseUri,
com.fasterxml.jackson.databind.JsonNode schemaNode,
boolean suppressSubSchemaRetrieval) |
Modifier and Type | Method and Description |
---|---|
JsonSchema |
findAncestor() |
CollectorContext |
getCollectorContext() |
URI |
getCurrentUri() |
com.fasterxml.jackson.databind.JsonNode |
getRefSchemaNode(String ref)
Find the schema node for $ref attribute.
|
JsonValidator |
getRequiredValidator() |
Map<String,JsonValidator> |
getValidators() |
boolean |
hasRequiredValidator() |
void |
initializeValidators()
Initializes the validators'
JsonSchema instances. |
String |
toString() |
Set<ValidationMessage> |
validate(com.fasterxml.jackson.databind.JsonNode jsonNode,
com.fasterxml.jackson.databind.JsonNode rootNode,
String at)
START OF VALIDATE METHODS
|
ValidationResult |
validateAndCollect(com.fasterxml.jackson.databind.JsonNode node) |
protected ValidationResult |
validateAndCollect(com.fasterxml.jackson.databind.JsonNode jsonNode,
com.fasterxml.jackson.databind.JsonNode rootNode,
String at)
This method both validates and collects the data in a CollectorContext.
|
ValidationResult |
walk(com.fasterxml.jackson.databind.JsonNode node,
boolean shouldValidateSchema)
Walk the JSON node
|
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.
|
buildValidationMessage, checkDiscriminatorMatch, debug, equals, fetchSubSchemaNode, getNodeFieldType, getParentSchema, getSchemaNode, getSchemaPath, getValidatorType, greaterThan, isPartOfOneOfMultipleType, lessThan, parseErrorCode, preloadJsonSchema, preloadJsonSchemas, registerAndMergeDiscriminator, validate
public JsonSchema(ValidationContext validationContext, URI baseUri, com.fasterxml.jackson.databind.JsonNode schemaNode)
public JsonSchema(ValidationContext validationContext, String schemaPath, URI currentUri, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parent)
public JsonSchema(ValidationContext validationContext, URI baseUri, com.fasterxml.jackson.databind.JsonNode schemaNode, boolean suppressSubSchemaRetrieval)
public URI getCurrentUri()
public com.fasterxml.jackson.databind.JsonNode getRefSchemaNode(String ref)
ref
- Stringpublic JsonSchema findAncestor()
public Set<ValidationMessage> validate(com.fasterxml.jackson.databind.JsonNode jsonNode, com.fasterxml.jackson.databind.JsonNode rootNode, String at)
jsonNode
- JsonNoderootNode
- JsonNodeat
- Stringpublic ValidationResult validateAndCollect(com.fasterxml.jackson.databind.JsonNode node)
protected ValidationResult validateAndCollect(com.fasterxml.jackson.databind.JsonNode jsonNode, com.fasterxml.jackson.databind.JsonNode rootNode, String at)
jsonNode
- JsonNoderootNode
- JsonNodeat
- String pathpublic ValidationResult walk(com.fasterxml.jackson.databind.JsonNode node, boolean shouldValidateSchema)
node
- JsonNodeshouldValidateSchema
- indicator on validationpublic Set<ValidationMessage> walk(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, String at, boolean shouldValidateSchema)
BaseJsonValidator
walk
in interface JsonSchemaWalker
walk
in class BaseJsonValidator
node
- JsonNoderootNode
- JsonNodeat
- StringshouldValidateSchema
- booleanpublic CollectorContext getCollectorContext()
public boolean hasRequiredValidator()
public JsonValidator getRequiredValidator()
public Map<String,JsonValidator> getValidators()
public void initializeValidators()
JsonSchema
instances.
For avoiding issues with concurrency, in 1.0.49 the JsonSchema
instances affiliated with
validators were modified to no more preload the schema and lazy loading is used instead.
This comes with the issue that this way you cannot rely on validating important schema features, in particular
$ref
resolution at instantiation from JsonSchemaFactory
.
By calling initializeValidators
you can enforce preloading of the JsonSchema
instances of the validators.
Copyright © 2021. All rights reserved.