Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#479 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

@mikeharder đang làm issue này rồi.

Từ ngày 5/5/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
C#
Star
290
Fork
50
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
10

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Azure/openapi-diff

Tất cả issue của Azure/openapi-diff

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.