public static @Nullable VirtualFile resolveSchemaByReference(@Nullable VirtualFile currentFile,
                                                               @Nullable String schemaUrl) {
    if (schemaUrl == null || StringUtil.isEmpty(schemaUrl)) return null;

    boolean isHttpPath = isHttpPath(schemaUrl);

    if (!isHttpPath && currentFile instanceof HttpVirtualFile) {
      // relative http paths
      String url = StringUtil.trimEnd(currentFile.getUrl(), "/");
      int lastSlash = url.lastIndexOf('/');
      assert lastSlash != -1;
      schemaUrl = url.substring(0, lastSlash) + "/" + schemaUrl;
    }
    else if (StringUtil.startsWithChar(schemaUrl, '.') || !isHttpPath) {
      // relative path
      VirtualFile parent = currentFile == null ? null : currentFile.getParent();
      schemaUrl = parent == null ? null :
                  parent.getUrl().startsWith(TEMP_URL) ? ("temp:///" + parent.getPath() + "/" + schemaUrl) :
                  VfsUtilCore.pathToUrl(parent.getPath() + File.separator + schemaUrl);
    }

    if (StringUtil.isEmpty(schemaUrl)) {
      return null;
    }
    else if (!schemaUrl.startsWith("http") || !Registry.is("json.schema.object.v2")) {
      return urlToFile(schemaUrl);
    }
    else {
      return getOrComputeVirtualFileForValidUrlOrNull(schemaUrl);
    }
  }
public static @Nullable VirtualFile resolveSchemaByReference(@Nullable VirtualFile currentFile,
                                                               @Nullable String schemaUrl)