如何解决按标签分割swagger json
{
"swagger": "2.0","tags": [
{
"name": "Tag1"
},{
"name": "Tag2"
},{
"name": "Tag3"
},{
"name": "Tag4"
}
],"paths": {
"/api/v1/entities/{entityId}/status": {
"post": {
"tags": [
"Tag1","Tag3"
],.
.
.
}
"get": {
"tags": [
"Tag1",.
.
.
}
},"/api/v1/entities": {
"post": {
"tags": [
"Tag2","Tag3"
]
.
.
.
}
}
}
例如 list = [“ Tag1”,“ Tag2”]-> 2个单独的文件:生成Tag1.json和Tag2.json,其必需的引用如下所示:
Tag1.json
{
"swagger": "2.0","tags": [
{
"name": "Tag3"
}
],"paths": {
"/api/v1/entities/{entityId}/status": {
"post": {
"tags": [
"Tag3"
],.
.
.
}
"get": {
"tags": [
"Tag3"
],.
.
.
}
}
}
Tag2.json
{
"swagger": "2.0","tags": [
{
"name": "Tag4"
}
],"paths": {
"/api/v1/entities": {
"post": {
"tags": [
"Tag3"
]
.
.
.
}
}
}
在相应的生成文件中,可以删除不必要的标签以防止显示空白部分。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。