dev.harrel.jsonschema.Schema Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-schema Show documentation
Show all versions of json-schema Show documentation
Library for JSON schema validation
The newest version!
package dev.harrel.jsonschema;
import java.net.URI;
import java.util.*;
import static dev.harrel.jsonschema.Evaluator.Result;
final class Schema {
private static final Evaluator TRUE_EVALUATOR = (ctx, node) -> Result.success();
private static final Evaluator FALSE_EVALUATOR = (ctx, node) -> Result.failure("False schema always fails");
private final URI parentUri;
private final String schemaLocation;
private final String schemaLocationFragment;
private final List evaluators;
private final MetaSchemaData metaSchemaData;
Schema(URI parentUri,
String schemaLocation,
List evaluators,
MetaSchemaData metaSchemaData,
Map objectMap) {
this.parentUri = Objects.requireNonNull(parentUri);
this.schemaLocation = Objects.requireNonNull(schemaLocation);
this.schemaLocationFragment = UriUtil.getJsonPointer(schemaLocation);
this.evaluators = evaluators;
this.evaluators.sort(Comparator.comparingInt(Evaluator::getOrder));
Optional