swagger-ui在CURL示例中添加api_token两次查询

时间:2015-11-16 15:54:14

标签: swagger swagger-ui

我正在设置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);

截图 enter image description here

Swagger删除路径

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

中可以看到同样的问题

如果有人知道修复或解决方法,我会很感激。

1 个答案:

答案 0 :(得分:1)

这已在swagger-js中解决。您可以通过在本地构建并使用npm link对抗本地构建的swagger-ui来更新您的swagger-ui。很快就会发布swagger-ui。