Jacob
Jacob

Reputation: 1004

swagger-ui adds api_token to query twice in CURL example

I am setting up our api documentation and i'm using swagger-spec and swagger ui.

I got everything working except that my CURL example adds our access_token twice

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"

I renamed the api_key in swagger_ui index

var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("access_token", key, "query"); 
window.swaggerUi.api.clientAuthorizations.add("access_token", apiKeyAuth);

Screenshot enter image description here

Swagger delete path

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: []

Security definition

securityDefinitions:
  access_token:
    type: string
    in: query
    name: access_token

The same issue can be seen in the swagger-ui live demo

If anyone knows of a fix or workaround i would appreciate it.

Upvotes: 0

Views: 579

Answers (1)

fehguy
fehguy

Reputation: 6824

This has just been addressed in swagger-js. You can update your swagger-ui by building this locally and using npm link against the local build of swagger-ui. The release of swagger-ui with this fix is coming soon.

Upvotes: 1

Related Questions