OpenAPITools / OpenAPITools/openapi-diff

Comparing OpenAPI 3.0.1 to 3.1.0 does not work

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

还没有人认领这个 Issue。

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

描述

When running a comparison between OpenAPI 3.0.1 and 3.1.0 via Docker, it looks like everything is reported as different.

Suppressing the details gives this:

$ docker run --rm -t -v .:/specs:ro  openapitools/openapi-diff /specs/api-docs-301.json /specs/api-docs-310.json --state
incompatible

ℹ Please note that those spec files are identical, only the initial OpenAPI version differs:

  • "openapi": "3.0.1"
  • "openapi": "3.1.0"

Comparing two specs with OpenAPI 3.1.0 seems to work as desired. ✅

I used latest which appears to be 6 weeks old - cannot get the version from the tool itself 🤷


Running the same via openapi-diff installed from brew shows a different error:

$ openapi-diff api-docs-301.json api-docs-310.json 
Unexpected exception. Reason: Cannot read new OpenAPI spec
java.lang.RuntimeException: Cannot read new OpenAPI spec
        at org.openapitools.openapidiff.core.OpenApiCompare.notNull(OpenApiCompare.java:107)
        at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:102)
        at org.openapitools.openapidiff.core.OpenApiCompare.fromLocations(OpenApiCompare.java:91)
        at org.openapitools.openapidiff.cli.Main.main(Main.java:174)

But this also does not work with two OpenAPI 3.1.0 specs:

$ openapi-diff api-docs-310.json api-docs-310.json 
Unexpected exception. Reason: Cannot read old OpenAPI spec
java.lang.RuntimeException: Cannot read old OpenAPI spec

Brew shows this to be version 2.0.1 - cannot get the version from the tool itself.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 Main.java 中的 CLI 入口点和 OpenApiCompare.java 中的规范加载路径开始,尤其关注堆栈跟踪中显示的调用。使用 3.0.1 和 3.1.0 中完全相同的文档重现 Docker 和 brew 命令,然后比较它们的行为。完成标准是:这些版本之间的有效比较能够正常工作,不会将完全相同的文档报告为不兼容,也不会读取失败。

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

评估

技术栈
docker, java, openapi
领域
api, backend-api-design
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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