我尝试更改json文件中的basePath,这似乎只是改变了swagger-UI的底层“baseurl”。我想摆脱出现作为我的swagger-UI的群组标题的“默认”。有没有人能解决这个问题?我正在使用Swagger~2.0。
答案 0 :(得分:18)
Default
不是路径,而是标记。
在Swagger 2.0中,使用标签进行分组。每个操作都可以分配给零个或多个标签。在用户界面中,任何没有标记的操作都将在Default
组下结束。
"/pet/findByStatus": {
"get": {
"tags": [
"pet"
],
"summary": "Finds Pets by status",
"description": "Multiple status values can be provided with comma seperated strings",
"operationId": "findPetsByStatus",
"consumes": [
"application/xml",
"application/json",
"multipart/form-data",
"application/x-www-form-urlencoded"
],
"produces": [
"application/xml",
"application/json"
],
"parameters": [
{
"name": "status",
"in": "query",
"description": "Status values that need to be considered for filter",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"default": "available",
"enum": [
"available",
"pending",
"sold"
]
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"400": {
"description": "Invalid status value"
}
},
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
}
}
您可以看到操作的tags
属性值为"pet"
,该操作将在该标题下分组。