private static @Nullable JsonValidationError tryMergeErrors(@NotNull Collection<JsonValidationError> errors, boolean isOneOf) {
    JsonValidationError.FixableIssueKind commonIssueKind = null;
    for (JsonValidationError error : errors) {
      JsonValidationError.FixableIssueKind currentIssueKind = error.getFixableIssueKind();
      if (currentIssueKind == JsonValidationError.FixableIssueKind.None) return null;
      else if (commonIssueKind == null) commonIssueKind = currentIssueKind;
      else if (currentIssueKind != commonIssueKind) return null;
    }

    if (commonIssueKind == JsonValidationError.FixableIssueKind.NonEnumValue) {
      String prefix = JsonBundle.message("schema.validation.enum.mismatch", "");
      @NlsSafe String text = errors.stream()
        // todo remove this ugly textual cutting
        .map(e -> StringUtil.trimEnd(StringUtil.trimStart(e.getMessage(), prefix), prefix) /*ltr and rtl*/)
        .map(e -> StringUtil.split(e, ", "))
        .flatMap(e -> e.stream())
        .distinct()
        .sorted()
        .collect(Collectors.joining(", "));
      return new JsonValidationError(prefix + text, commonIssueKind, null, errors.iterator().next().getPriority());
    }

    if (commonIssueKind == JsonValidationError.FixableIssueKind.MissingProperty) {
      String sets = errors.stream().map(e -> (JsonValidationError.MissingMultiplePropsIssueData)e.getIssueData())
        .map(d -> d.getMessage(false)).collect(NlsMessages.joiningOr());
      return new JsonValidationError(JsonBundle.message(
        isOneOf ? "schema.validation.one.of.property.sets.required" : "schema.validation.at.least.one.of.property.sets.required", sets),
                                     isOneOf ? JsonValidationError.FixableIssueKind.MissingOneOfProperty : JsonValidationError.FixableIssueKind.MissingAnyOfProperty,
                                     new JsonValidationError.MissingOneOfPropsIssueData(
                                       ContainerUtil.map(errors, e -> (JsonValidationError.MissingMultiplePropsIssueData)e.getIssueData())), errors.iterator().next().getPriority());
    }

    if (commonIssueKind == JsonValidationError.FixableIssueKind.ProhibitedType) {
      final Set<JsonSchemaType> allTypes = errors.stream().map(e -> (JsonValidationError.TypeMismatchIssueData)e.getIssueData())
        .flatMap(d -> Arrays.stream(d.expectedTypes)).collect(Collectors.toSet());

      if (allTypes.size() == 1) return errors.iterator().next();

      List<String> actualInfos = errors.stream().map(e -> e.getMessage()).map(JsonSchemaAnnotatorChecker::fetchActual).distinct().toList();
      String actualInfo = actualInfos.size() == 1 ? (" " + JsonBundle.message("schema.validation.actual") + actualInfos.get(0) + ".") : "";
      String commonTypeMessage = JsonBundle.message("schema.validation.incompatible.types") + "\n" +
                                 JsonBundle.message("schema.validation.required.one.of",
                                                    allTypes.stream().map(t -> t.getDescription()).sorted().collect(Collectors.joining(", ")),
                                                    actualInfo);
      return new JsonValidationError(commonTypeMessage, JsonValidationError.FixableIssueKind.TypeMismatch,
                                     new JsonValidationError.TypeMismatchIssueData(ContainerUtil.toArray(allTypes, JsonSchemaType[]::new)),
                                     errors.iterator().next().getPriority());
    }

    return null;
  }
private static @Nullable JsonValidationError tryMergeErrors(@NotNull Collection<JsonValidationError> errors, boolean isOneOf)