0
我正在使用swagger doc爲我的應用程序生成API。 Doc是用yml編寫的,在某些地方它會定義一些枚舉的道具(我們使用mysql)。這看起來像:Swagger:首次枚舉值覆蓋類型
properties:
type:
enum:
- "first"
- "second"
- "example"
type: "string"
title:
type: "string"
... // And so on and on
我期待得到的東西是這樣的:
{
"type": "string",
"title": "string",
}
正如你所看到的,類型字段將是爲在配置文件中定義的字符串,但我我正在接受這一個:
{
"type": "first",
"title": "string",
}
Swagger設置第一個值作爲數據類型,它絕對不正確。 所以問題是如何爲「類型」字段獲取值「字符串」。