dev.harrel.jsonschema.Draft7EvaluatorFactory 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.util.*;
import static dev.harrel.jsonschema.Keyword.*;
/**
* {@code EvaluatorFactory} implementation that supports draft 7 specification.
*/
public class Draft7EvaluatorFactory extends AbstractEvaluatorFactory {
public Draft7EvaluatorFactory() {
super(getIgnoredKeywords(), createEvaluatorMap());
}
private static Set getIgnoredKeywords() {
return new HashSet<>(Arrays.asList(ID, SCHEMA, COMMENT, DEFINITIONS, THEN, ELSE));
}
private static Map createEvaluatorMap() {
Map map = createDefaultEvaluatorsMap(null, null, null, null);
map.put(ITEMS, new EvaluatorInfo(null, ItemsLegacyEvaluator::new));
map.put(ADDITIONAL_ITEMS, new EvaluatorInfo(null, AdditionalItemsEvaluator::new));
map.put(DEPENDENCIES, new EvaluatorInfo(null, DependenciesLegacyEvaluator::new));
map.remove(MAX_CONTAINS);
map.remove(MIN_CONTAINS);
map.remove(DEPENDENT_REQUIRED);
map.remove(DEPENDENT_SCHEMAS);
map.remove(UNEVALUATED_ITEMS);
map.remove(UNEVALUATED_PROPERTIES);
return map;
}
}