[REQ] Python client will not allow request auth overrides in
Created by: dd-ashishaev
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Currently, if the openapi spec doesn't define auth for an endpoint, the users won't be able to set custom auth on individual requests via _request_auths.
This is due to this line:
openapi-generator version
v6.2.0
OpenAPI declaration file content or url
This is an endpoint from petstore.yaml that will have this issue. The only difference with the original endpoint is that security:
keys are removed.
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'405':
description: Invalid input
requestBody:
$ref: '#/components/requestBodies/Pet'
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
requestBody:
$ref: '#/components/requestBodies/Pet'
Generation Details
This happens when python
is used as the template, irrespective of the config.
Steps to reproduce
This line looks like it would respect the custom auth settings, judging by api_client.py:
api_response = api_instance.v3_my_endpoint(endpoint_body, _request_auths=[{'in':'header', 'type': 'bearer', 'key': 'Authorization', 'value': f"Bearer {TOKEN}"}])
However, the request will still be sent without any auth settings, no exceptions thrown.