Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Crash if duplicate model names (across files) used in allOf

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

@mikeharder 已经在做这个了。

开始于 2026年5月5日。

评估

这个 Issue 还没有评估数据。

描述

A TSP conversion PR resulted in this error:

"details":"incompatible properties : tags

definitions/ContainerGroup/properties/tags
 at file:///home/runner/work/azure-rest-api-specs/azure-rest-api-specs/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/ContainerInstance/stable/2025-09-01/containerInstance.json#L2245:8

definitions/Resource/properties/tags
  at file:///home/runner/work/azure-rest-api-specs/azure-rest-api-specs/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/ContainerInstance/stable/2025-09-01/containerInstance.json#L4642:8"

Root cause, oad cannot handle two definitions in different files with the same name, if one definition is used in an allOf:

duplicate-names.json
{
  "swagger": "2.0",
  "info": {
    "title": "duplicate-names",
    "version": "1.0"
  },
  "paths": {},
  "definitions": {
    "Bar": {
      "type": "object",
      "properties": {
        "p1": {
          "type": "string"
        }
      },
      "allOf": [
        {
          "$ref": "./common-types.json#/definitions/Foo"
        }
      ]
    },
    "Foo": {
      "type": "object",
      "properties": {
        "p1": {
          "type": "object"
        }
      }
    }
  }
}
common-types.json
{
  "swagger": "2.0",
  "info": {
    "title": "common-types",
    "version": "1.0"
  },
  "paths": {},
  "definitions": {
    "Foo": {
      "type": "object",
      "properties": {
        "p1": {
          "type": "string"
        }
      }
    }
  }
}
test result
    incompatible properties : p1
      definitions/Bar/properties/p1
        at file:///home/mharder/openapi-diff-mh/incompat-prop/src/test/specs/incompatible-properties/duplicate-names.json#L12:8
      definitions/Foo/properties/p1
        at file:///home/mharder/openapi-diff-mh/incompat-prop/src/test/specs/incompatible-properties/duplicate-names.json#L25:8

Reason, it assumes model names are unique across all files:

https://github.com/Azure/openapi-diff/blob/bb4653d32f49ceb2abab48656c42c253865697e1/src/lib/util/resolveSwagger.ts#L346-L352

Related: #347

主要语言
C#
星标
290
派生
50
平均合并
2 天 21 小时
30 天内合并 PR
10

贡献指南

打开贡献指南

从这里开始

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

Azure/openapi-diff 的其他 Issue

查看 Azure/openapi-diff 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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