From d4383fed22e7345ba6612f7b2899a19f3ba48cdb Mon Sep 17 00:00:00 2001 From: Anton Lobov Date: Wed, 1 Aug 2018 11:30:48 +0200 Subject: [PATCH] json schema: avoid textual error match, looks like an ugly hack --- .../jsonSchema/impl/JsonSchemaAnnotatorChecker.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java index 5979b0c89c9d..a14aa2b408b0 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java @@ -89,18 +89,20 @@ class JsonSchemaAnnotatorChecker { private static JsonSchemaAnnotatorChecker mergeErrors(@NotNull List list, @NotNull List selectedSchemas, @NotNull JsonComplianceCheckerOptions options) { - final Set skipErrors = selectedSchemas.stream().filter(Predicates.notNull()) + final Set propNames = selectedSchemas.stream().filter(Predicates.notNull()) .map(schema -> schema.getProperties().keySet()) - .flatMap(Set::stream).map(name -> JsonBundle.message("json.schema.annotation.not.allowed.property", name)) + .flatMap(Set::stream) .collect(Collectors.toSet()); final JsonSchemaAnnotatorChecker checker = new JsonSchemaAnnotatorChecker(options); for (JsonSchemaAnnotatorChecker ch: list) { for (Map.Entry element: ch.myErrors.entrySet()) { - if (skipErrors.contains(element.getValue().getMessage())) { + JsonValidationError error = element.getValue(); + if (error.getFixableIssueKind() == JsonValidationError.FixableIssueKind.ProhibitedProperty + && propNames.contains(((JsonValidationError.ProhibitedPropertyIssueData)error.getIssueData()).propertyName)) { continue; } - checker.myErrors.put(element.getKey(), element.getValue()); + checker.myErrors.put(element.getKey(), error); } } return checker;