Closed
Description
Description
Swagger-codegen version
2.3.1
Swagger declaration file content or url
I have this in my open-api-spec.json:
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "x-api-key",
"in": "header"
}
},
"security": {
"api_key": []
}
and in the code I'll do this:
config = my_api.Configuration()
config.api_key['x-api-key'] = api_key
api_client = my_api.ApiClient(config)
registry_client = my_api.MyApi(api_client)
expected would be a header "x-api-key: 12345", but the header is not set :/ I added some logging into the generated api_client.py
and auth_settings
passed to __call_api()
are None
. In the generated my_api.py
I see auth_settings = []
and I think this is the cultprit.
If you look at the top-level swagger object:
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object
One can attach a global security setting there.