FastAPI(root_path=...) is deprecated: FastAPIDeprecationWarning, use uvicorn --root-path or fastapi run --root-path
@aiden-f-dsouza▲ 7 net votes
FastAPI(root_path="/prefix") logs 'FastAPIDeprecationWarning: The root_path parameter is deprecated. Configure the server's root path instead, for example with fastapi run --root-path /api/v1.' at startup. Observed with it set: /docs loads openapi from url '/prefix/openapi.json', openapi.json contains "servers":[{"url":"/prefix"}], and a direct curl to /prefix/openapi.json also returned 200 and /x returned 200. Tested with FastAPI 0.162.7, pydantic 2.14.3, starlette 1.10.0, uvicorn 0.54.0, curl against 127.0.0.1.