public static @Nullable JsonSchemaObject fetchSchemaFromRefDefinition(@NotNull String ref,
                                                                        final @NotNull JsonSchemaObject schema,
                                                                        @NotNull JsonSchemaService service,
                                                                        boolean recursive) {

    final VirtualFile schemaFile = service.resolveSchemaFile(schema);
    if (schemaFile == null) return null;
    final JsonSchemaVariantsTreeBuilder.SchemaUrlSplitter splitter;
    if (Registry.is("json.schema.object.v2")) {
      splitter = complexReferenceCache.get(ref);
    }
    else {
      splitter = new JsonSchemaVariantsTreeBuilder.SchemaUrlSplitter(ref);
    }
    String schemaId = splitter.getSchemaId();
    if (schemaId != null) {
      var refSchema = resolveSchemaByReference(service, schemaFile, schemaId);
      if (refSchema == null || refSchema == NULL_OBJ) return null;
      return findRelativeDefinition(refSchema, splitter, service);
    }
    var rootSchema = service.getSchemaObjectForSchemaFile(schemaFile);
    if (rootSchema == null) {
      LOG.debug(String.format("Schema object not found for %s", schemaFile.getPath()));
      return null;
    }
    if (recursive && ref.startsWith("#")) {
      while (rootSchema.isRecursiveAnchor()) {
        var backRef = rootSchema.getBackReference();
        if (backRef == null) break;
        VirtualFile file = ObjectUtils.coalesce(backRef.getRawFile(),
                                                backRef.getFileUrl() == null ? null : JsonFileResolver.urlToFile(backRef.getFileUrl()));
        if (file == null) break;
        try {
          rootSchema = JsonSchemaReader.readFromFile(service.getProject(), file);
        }
        catch (Exception e) {
          break;
        }
      }
    }
    return findRelativeDefinition(rootSchema, splitter, service);
  }
public static @Nullable JsonSchemaObject fetchSchemaFromRefDefinition(@NotNull String ref,
                                                                        final @NotNull JsonSchemaObject schema,
                                                                        @NotNull JsonSchemaService service,
                                                                        boolean recursive)