Class EvaluationContext

java.lang.Object
dev.harrel.jsonschema.EvaluationContext

public final class EvaluationContext extends Object
EvaluationContext class represents state of current evaluation (instance validation against schema). Evaluator can use this class for its processing logic.
See Also:
  • Method Details

    • resolveRefAndValidate

      public boolean resolveRefAndValidate(String schemaRef, JsonNode node)
      Resolves schema using provided reference string, and then validates instance node against it. This method can invoke SchemaResolver.
      Parameters:
      schemaRef - reference to the schema
      node - instance node to be validated
      Returns:
      if validation was successful
      Throws:
      SchemaNotFoundException - when schema cannot be resolved
    • resolveDynamicRefAndValidate

      public boolean resolveDynamicRefAndValidate(String schemaRef, JsonNode node)
      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 schema
      node - instance node to be validated
      Returns:
      if validation was successful
      Throws:
      SchemaNotFoundException - when schema cannot be resolved
    • resolveRecursiveRefAndValidate

      public boolean resolveRecursiveRefAndValidate(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. 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

      public boolean resolveInternalRefAndValidate(String schemaRef, JsonNode node)
      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 from resolveRefAndValidate(java.lang.String, dev.harrel.jsonschema.JsonNode) and it cannot invoke SchemaResolver.
      Parameters:
      schemaRef - reference to the schema
      node - instance node to be validated
      Returns:
      if validation was successful
      Throws:
      SchemaNotFoundException - when schema cannot be resolved