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

    • getEvaluationItems

      public List<dev.harrel.jsonschema.EvaluationItem> getEvaluationItems()
      Returns collected annotations up to this point. Discarded annotations are not included.
      Returns:
      unmodifiable list of annotations
    • 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
    • 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