dev.harrel:json-schema Help

Evaluators

Evaluator represents keyword logic. Each keyword can have at most one evaluator attached.

public interface Evaluator { Result evaluate(EvaluationContext ctx, JsonNode node); default int getOrder() { return 0; } }

Evaluation context

It can be used to trigger another schema validation process in several ways:

  • Internal - in most cases, you would want to use this one. If a schema you want to validate against is contained somewhere in the keyword's value, this is the correct approach (e.g. properties or anyOf keywords use it). When using this approach, it should be guaranteed that the reference resolves to a valid schema. It won't trigger any schema resolvers.

  • $ref like - follows the same behavior as $ref keyword.

  • $dynamicRef like (since draft 2020-12) - follows the same behavior as $dynamicRef keyword.

  • $recursiveRef like (available only in draft 2019-09) - follows the same behavior as $recursiveRef keyword.

Result object

Evaluation can result in either:

  • success (Evaluator.Result.success()),

  • success with an annotation (Evaluator.Result.success(Object annotation)),

  • failure (Evaluator.Result.failure()),

  • failure with a message (Evaluator.Result.failure(String message)).

04 August 2025