【问题标题】:swagger-ui adds api_token to query twice in CURL exampleswagger-ui 添加 api_token 以在 CURL 示例中查询两次
【发布时间】: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


    【解决方案1】:

    swagger-js 刚刚解决了这个问题。您可以通过在本地构建它并针对 swagger-ui 的本地构建使用 npm link 来更新您的 swagger-ui。带有此修复程序的 swagger-ui 即将发布。

    【讨论】:

      猜你喜欢
      • 2018-10-04
      • 1970-01-01
      • 2020-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多