diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py index 6c4a1bd7f..ac8f76149 100644 --- a/fastapi/openapi/utils.py +++ b/fastapi/openapi/utils.py @@ -197,7 +197,7 @@ def get_openapi_operation_metadata( operation["description"] = route.description operation_id = route.operation_id or route.unique_id if len(route.methods) > 1: - operation_id = f'{operation_id}_{method.lower()}' + operation_id = f"{operation_id}_{method.lower()}" if operation_id in operation_ids: message = ( f"Duplicate Operation ID {operation_id} for function " diff --git a/tests/test_application.py b/tests/test_application.py index 690258ba0..f6618ed7c 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -1171,9 +1171,9 @@ def test_openapi_schema(): "responses": { "200": { "description": "Successful Response", - "content": {"application/json": {"schema": {}}} + "content": {"application/json": {"schema": {}}}, } - } + }, }, "post": { "summary": "Multiple Methods", @@ -1181,15 +1181,11 @@ def test_openapi_schema(): "responses": { "200": { "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } + "content": {"application/json": {"schema": {}}}, } - } - } - } + }, + }, + }, }, "components": { "schemas": {