diff --git a/json/src/com/jetbrains/jsonSchema/extension/adapters/JsonValueAdapter.java b/json/src/com/jetbrains/jsonSchema/extension/adapters/JsonValueAdapter.java index 1d8f27421dc2..f46e4a0f1334 100644 --- a/json/src/com/jetbrains/jsonSchema/extension/adapters/JsonValueAdapter.java +++ b/json/src/com/jetbrains/jsonSchema/extension/adapters/JsonValueAdapter.java @@ -37,4 +37,5 @@ public interface JsonValueAdapter { @Nullable JsonArrayValueAdapter getAsArray(); default boolean shouldCheckIntegralRequirements() {return true;} + default boolean shouldCheckAsValue() {return true;} } diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java index f9def7dbc8ac..fce28ba0e996 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java @@ -488,6 +488,7 @@ class JsonSchemaAnnotatorChecker { @Nullable JsonValueAdapter adapter, @NotNull String text, @NotNull BiFunction stringEq) { + if (adapter != null && !adapter.shouldCheckAsValue()) return true; if (object instanceof EnumArrayValueWrapper) { if (adapter instanceof JsonArrayValueAdapter) { List elements = ((JsonArrayValueAdapter)adapter).getElements(); @@ -673,6 +674,7 @@ class JsonSchemaAnnotatorChecker { for (Map.Entry> entry: valueTexts.entrySet()) { if (entry.getValue().size() > 1) { for (JsonValueAdapter item: entry.getValue()) { + if (!item.shouldCheckAsValue()) continue; error("Item is not unique", item.getDelegate(), JsonErrorPriority.TYPE_MISMATCH); } } @@ -727,6 +729,8 @@ class JsonSchemaAnnotatorChecker { private void checkString(PsiElement propValue, JsonSchemaObject schema) { final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(propValue, schema); assert walker != null; + JsonValueAdapter adapter = walker.createValueAdapter(propValue); + if (adapter != null && !adapter.shouldCheckAsValue()) return; final String value = StringUtil.unquoteString(walker.getNodeTextForValidation(propValue)); if (schema.getMinLength() != null) { if (value.length() < schema.getMinLength()) { @@ -760,6 +764,8 @@ class JsonSchemaAnnotatorChecker { Number value; final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(propValue, schema); assert walker != null; + JsonValueAdapter adapter = walker.createValueAdapter(propValue); + if (adapter != null && !adapter.shouldCheckAsValue()) return; String valueText = walker.getNodeTextForValidation(propValue); if (JsonSchemaType._integer.equals(schemaType)) { try {