Skip to content

Commit

Permalink
Trims more away
Browse files Browse the repository at this point in the history
  • Loading branch information
spacether committed Dec 19, 2023
1 parent 4c604ee commit 901e2e9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,9 @@

public abstract class JsonSchema {
public final @Nullable Set<Class<?>> type;
private final @NonNull LinkedHashMap<String, KeywordValidator> keywordToValidator;

protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) {
LinkedHashMap<String, KeywordValidator> keywordToValidator = new LinkedHashMap<>();
this.type = jsonSchemaInfo.type;
if (this.type != null) {
keywordToValidator.put(
"type",
new TypeValidator(this.type)
);
}
this.keywordToValidator = keywordToValidator;
}

public static PathToSchemasMap validate(
JsonSchema jsonSchema,
Object arg,
ValidationMetadata validationMetadata
) throws ValidationException {
LinkedHashSet<String> disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords();
PathToSchemasMap pathToSchemas = new PathToSchemasMap();
LinkedHashMap<String, KeywordValidator> thisKeywordToValidator = jsonSchema.keywordToValidator;
if (thisKeywordToValidator != null) {
for (Map.Entry<String, KeywordValidator> entry: thisKeywordToValidator.entrySet()) {
String jsonKeyword = entry.getKey();
if (disabledKeywords.contains(jsonKeyword)) {
continue;
}
KeywordValidator validator = entry.getValue();
PathToSchemasMap otherPathToSchemas = validator.validate(
jsonSchema,
arg,
validationMetadata
);
if (otherPathToSchemas == null) {
continue;
}
pathToSchemas.update(otherPathToSchemas);
}
}
List<Object> pathToItem = validationMetadata.pathToItem();
if (!pathToSchemas.containsKey(pathToItem)) {
pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>());
}
pathToSchemas.get(pathToItem).put(jsonSchema, null);

return pathToSchemas;
}

public static class PathToSchemasMap extends LinkedHashMap<List<Object>, LinkedHashMap<JsonSchema, Void>> {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 901e2e9

Please sign in to comment.