All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.harrel.jsonschema.Draft7EvaluatorFactory Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy