我試圖記錄與靜態招搖文件的API,可以返回一些JSON包含數組,看起來是這樣的:如何在Swagger規範中定義不同示例的數組?
[
{
"type": "type A",
"field A": "this field is specific to type A"
},
{
"type": "type B",
"field B": "this field is specific to type B"
}
]
我試着用我的定義規範的幾個不同的方法多態或者明確定義多個例子。這些例子往往不是最終看上去像:
[
{
"type": "type A",
"field A": "this field is specific to type A",
"field B": "this field is specific to type B"
}
]
或者只是:
[
{
"type": "type A",
"field A": "this field is specific to type A"
}
]
有沒有辦法在我昂首闊步規範定義一個例子,這樣的招搖-UI中所示的例子有效載荷,將包含一個數組,其中包含類型A的示例和類型B的示例,就像我寫的第一個JSON一樣?
[如何創建一個招搖的模式,包括不同類型的數組]的可能的複製(https://stackoverflow.com/questions/36318849/how-do-you-create-a -swagger-架構 - 即-包括-AN-陣列的變類型) – Helen