swagger-test-templates
swagger-test-templates copied to clipboard
Multiple apiKey security parameters
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.
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