【发布时间】:2016-02-17 18:58:00
【问题描述】:
我正在设置我们的 api 文档,我正在使用 swagger-spec 和 swagger ui。
除了我的 CURL 示例添加了两次 access_token 之外,一切正常
curl -X DELETE --header "Accept: application/json" "http://api host/api/user?filter%5Bid%5D%5BEQUAL%5D=1&access_token=Token_TOKANE&access_token=Token_TOKANE"
我在 swagger_ui 索引中重命名了 api_key
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("access_token", key, "query");
window.swaggerUi.api.clientAuthorizations.add("access_token", apiKeyAuth);
大摇大摆的删除路径
delete:
tags:
- User
summary: Delete user from you organization
operationId: deleteUser
description: Deletes a single by id. Gets id from filter param in query
parameters:
- name: filter[id][EQUAL]
in: query
type: integer
required: true
description: id to delete
responses:
200:
description: OK
schema:
$ref: '#/definitions/Message'
security:
- access_token: []
安全定义
securityDefinitions:
access_token:
type: string
in: query
name: access_token
同样的问题可以在 swagger-ui live demo 中看到
如果有人知道修复或解决方法,我将不胜感激。
【问题讨论】:
标签: swagger swagger-ui