swagger-test-templates icon indicating copy to clipboard operation
swagger-test-templates copied to clipboard

Multiple apiKey security parameters

Open jamesabc opened this issue 8 years ago • 1 comments

I have the following valid swagger.yaml:

paths:
  /assets:
    get:
      tags:
        - Assets
      summary: Returns base paths for asset files
      security:
        - ClientVersion: []
        - ClientApiKey: []
        - ApiVersion: []
      responses:
        '200':
          description: Assets Paths
          schema:
            $ref: '#/definitions/AssetsResponse'

Almost every request to my API uses the same 3 headers, so I found it reduced boilerplate a lot to specify them in securityDefinitions.

It may not be the best way, as I am new to swagger, so I am open to advice if you know of a better way to achieve this, but at the same time, given that this is syntactically valid in swagger, it is a problem that only the first item in the security list is sent to the template as data.headerApiKey (line 115 of index.js), and the rest are ignored.

jamesabc avatar Oct 05 '16 11:10 jamesabc

well, I don't think it is a very nice way to send headers (they are not all security headers), but you already said that yourself :-) That being said: I can imagine more that one security header needed, so looping over the security array seems ok. But we will need to think about naming, and rendering them in the templates.

That would make only feasible after we do #117

Remco75 avatar Oct 06 '16 08:10 Remco75