Package dev.harrel.jsonschema
Class EvaluationContext
java.lang.Object
dev.harrel.jsonschema.EvaluationContext
EvaluationContext class represents state of current evaluation (instance validation against schema).
Evaluator can use this class for its processing logic.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanresolveDynamicRefAndValidate(String schemaRef, JsonNode node) Dynamically resolves schema using provided reference string, and then validates instance node against it.booleanresolveInternalRefAndValidate(String schemaRef, JsonNode node) Resolves internal schema using provided reference string and then validates instance node against it.booleanresolveRecursiveRefAndValidate(String schemaRef, JsonNode node) Recursively resolves schema using provided reference string (current implementation behaves the same for any reference string), and then validates instance node against it.booleanresolveRefAndValidate(String schemaRef, JsonNode node) Resolves schema using provided reference string, and then validates instance node against it.
-
Method Details
-
resolveRefAndValidate
Resolves schema using provided reference string, and then validates instance node against it. This method can invokeSchemaResolver.- Parameters:
schemaRef- reference to the schemanode- instance node to be validated- Returns:
- if validation was successful
- Throws:
SchemaNotFoundException- when schema cannot be resolved
-
resolveDynamicRefAndValidate
Dynamically resolves schema using provided reference string, and then validates instance node against it. This method is specifically created for $dynamicRef keyword.- Parameters:
schemaRef- reference to the schemanode- instance node to be validated- Returns:
- if validation was successful
- Throws:
SchemaNotFoundException- when schema cannot be resolved
-
resolveRecursiveRefAndValidate
Recursively resolves schema using provided reference string (current implementation behaves the same for any reference string), and then validates instance node against it. This method is specifically created for $recursiveRef keyword.- Parameters:
schemaRef- reference to the schema (specification-wise this should always have a value of '#')node- instance node to be validated- Returns:
- if validation was successful
- Throws:
SchemaNotFoundException- when schema cannot be resolved
-
resolveInternalRefAndValidate
Resolves internal schema using provided reference string and then validates instance node against it. This method should only be used for internal schema resolutions, that means schema/evaluator calling this method should only refer to schema instances which are descendants of calling node. Note that this method is semantically different fromresolveRefAndValidate(java.lang.String, dev.harrel.jsonschema.JsonNode)and it cannot invokeSchemaResolver.- Parameters:
schemaRef- reference to the schemanode- instance node to be validated- Returns:
- if validation was successful
- Throws:
SchemaNotFoundException- when schema cannot be resolved
-