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
它只保留最后一个。怎么可能解决这个问题(如果是的话)?
谢谢你。