-
-
Notifications
You must be signed in to change notification settings - Fork 776
Open
Description
Description
When having 2 reponse types one is problem+json is unable to infer response
Expected behaviour
Should be able to infer that is a dictionary with no header and asume is json response or just check 200 response is always application/json
Actual behaviour
if another response like 401 is present with a different content type like application/problem+json should still be able to infer is a json
Steps to reproduce
as API
/potato/advanced-configuration:
get:
summary: xxx
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/xxx'
'401':
description: Returned if the calling user does not have permission to perform the operation.
content:
application/problem+json:
schema:
$ref: ../common/models/error.v1.yaml
operationId: configuration.get_configuration
def get_configuration():
try:
response = cb_conf.read_conf() or {}
status_code = 200
except Exception as ex:
logging.error(f"Error getting configuration: {ex}")
response, status_code = unexpected_exception(ex), 400
print(response, status_code)
return response, status_code
Additional info:
{"time": "2024-07-31T10:51:30Z", "format_version": 1, "level": "ERROR", "message": "NonConformingResponseHeaders(status_code=500, detail='Multiple response content types are defined in the operation spec, but the handler response did not specify which one to return.')", "microservice": "cbclient", "funcName": "problem_handler", "threadName": "AnyIO worker thread"}
Output of the commands:
python --version
3.11pip show connexion | grep "^Version\:"
3.1
Metadata
Metadata
Assignees
Labels
No labels