Following tutorial here: https://fastapi.tiangolo.com/advanced/response-change-status-code/
Adding response as a parameter to an endpoint completely breaks swagger ui, server throws
...
File "/Users/atartanian/Development/carmera/carmera_take_home/.venv/lib/python3.8/site-packages/fastapi/openapi/utils.py", line 101, in get_openapi_operation_parameters
"schema": field_schema(
File "pydantic/schema.py", line 177, in pydantic.schema.field_schema
File "pydantic/schema.py", line 712, in pydantic.schema.encode_default
File "pydantic/json.py", line 62, in pydantic.json.pydantic_encoder
TypeError: Object of type 'type' is not JSON serializable
from fastapi import FastAPI, Response
app = FastAPI()
@app.get("/test", status_code=200)
async def test(
response=Response
):
return {"message": "tada"}
macOS0.60.13.8.2
Fix: response=Response -> response: Response.
from fastapi import FastAPI, Response
app = FastAPI()
@app.get("/test", status_code=200)
async def test(
response: Response
):
return {"message": "tada"}

Thanks for the help here @Kludex ! :clap: :bow:
Thanks for reporting back and closing the issue @atartanian :+1: ...that pic was very funny :joy:
Most helpful comment
Fix:
response=Response->response: Response.