public static @Nullable JsonSchemaType getMatchingSchemaType(@NotNull JsonSchemaObject schema, @Nullable JsonSchemaType input) {
    final JsonSchemaType matchType = schema.getType();
    if (matchType != null) {
      if (JsonSchemaType._integer.equals(input) && JsonSchemaType._number.equals(matchType)) {
        return input;
      }
      if (JsonSchemaType._string_number.equals(input) && (JsonSchemaType._number.equals(matchType)
                                                          || JsonSchemaType._integer.equals(matchType)
                                                          || JsonSchemaType._string.equals(matchType))) {
        return input;
      }
      return matchType;
    }
    if (schema.getTypeVariants() != null) {
      Set<JsonSchemaType> matchTypes = schema.getTypeVariants();
      if (matchTypes.contains(input)) {
        return input;
      }
      if (JsonSchemaType._integer.equals(input) && matchTypes.contains(JsonSchemaType._number)) {
        return input;
      }
      if (JsonSchemaType._string_number.equals(input) &&
          (matchTypes.contains(JsonSchemaType._number)
           || matchTypes.contains(JsonSchemaType._integer)
           || matchTypes.contains(JsonSchemaType._string))) {
        return input;
      }
      //nothing matches, lets return one of the list so that other heuristics does not match
      return matchTypes.iterator().next();
    }
    if (JsonSchemaObjectReadingUtils.hasProperties(schema) && JsonSchemaType._object.equals(input)) return JsonSchemaType._object;
    return null;
  }
public static @Nullable JsonSchemaType getMatchingSchemaType(@NotNull JsonSchemaObject schema, @Nullable JsonSchemaType input)