0

Swagger 文档我们可以使用指定为数组类型的复杂类型对象,如下所示:

"type": "array",
  "items": {
    "$ref": "#/components/schemas/VeryComplexType"
}

但是,如果您有一系列不同的复杂类型(例如country,address等)怎么办?尝试传递多个时$ref,如下所示:

"type": "array",
  "items": {
    "$ref": "#/components/schemas/VeryComplexType-1"
    "$ref": "#/components/schemas/VeryComplexType-2"
    "$ref": "#/components/schemas/VeryComplexType-3"
}

引发错误:

warning: key :$ref is duplicated and overwritten on line 245
warning: key :$ref is duplicated and overwritten on line 246

它只保留最后一个。怎么可能解决这个问题(如果是的话)?

谢谢你。

4

1 回答 1

0

它从 Open API 3.0 开始可用,并在此问题上进行了讨论。

由于仅rswag 支持 Swagger 2.0,因此不可能。

于 2019-03-14T10:00:26.590 回答