PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session, Collection<PsiElement> roots, JsonSchemaObject schema) { PsiElement sampleElement = roots.iterator().next(); final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(sampleElement, schema); if (walker == null || schema == null) { return PsiElementVisitor.EMPTY_VISITOR; } Project project = sampleElement.getProject(); return new YamlPsiElementVisitor() { @Override public void visitKeyValue(@NotNull YAMLKeyValue keyValue) { annotate(keyValue); super.visitKeyValue(keyValue); } private void annotate(@NotNull YAMLKeyValue keyValue) { PsiElement key = keyValue.getKey(); if (key == null) { return; } JsonPointerPosition position = walker.findPosition(keyValue, true); if (position == null) { return; } final MatchResult result = new JsonSchemaResolver(project, schema, position).detailedResolve(); for (JsonSchemaObject object : result.mySchemas) { String message = object.getDeprecationMessage(); if (message != null) { holder.registerProblem(key, YAMLBundle.message("inspections.schema.deprecation.text", keyValue.getName(), message)); return; } } } }; }