OpenAPITools / OpenAPITools/openapi-diff

IllegalArgumentException: "Invalid ref..." when uses an external link like "../demo#/components"

未关闭
#810 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
1.1k
派生
190
PR 合并指标
30 天内没有已合并 PR

描述

Hello, thinks for the nice tools, but i faced a problem where when i uses an external link, an exception was thrown
Exception in thread "main" java.lang.IllegalArgumentException: Invalid ref: ../../common/restapi-sdk-data-schemas.yaml#/components/schemas/ApiError at org.openapitools.openapidiff.core.utils.RefPointer.getRefName(RefPointer.java:60) at org.openapitools.openapidiff.core.utils.RefPointer.resolveRef(RefPointer.java:16) at org.openapitools.openapidiff.core.compare.SchemaDiff.computeDiffForReal(SchemaDiff.java:340) at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.processSchemaQueue(DeferredSchemaCache.java:86) at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.process(DeferredSchemaCache.java:64) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:113) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:72) at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:166) at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:153)

After read sourcecode, i think i have no any way to trun off the checks on ref

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 org.openapitools.openapidiff.core.utils.RefPointer.java 的 getRefName 开始,然后跟踪 stack trace 中显示的 resolveRef 和 SchemaDiff.computeDiffForReal 调用。使用类似 ../../common/restapi-sdk-data-schemas.yaml#/components/schemas/ApiError 的外部引用重现比较,并确定对该引用的预期处理方式,且不要引发 Invalid ref。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, openapi
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。