-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ORJSONResponse is deprecated #6139
Description
Description
This is a notification regarding the use of ORJSONResponse from FastAPI in the codebase (reference commit 6f5203a).
ORJSONResponse has been officially deprecated in FastAPI. The FastAPI documentation notes that data is now serialized directly to JSON bytes via Pydantic when a return type or response model is set. This native method is faster and eliminates the need for a custom response class.
Proposed Updates
Endpoints currently utilizing ORJSONResponse can be refactored to use standard response models and return types, leveraging FastAPI and Pydantic's default serialization.
As a result, orjson can also be safely removed as a separate dependency if it is no longer required elsewhere in the project.
References:
FastAPI docs for Custom Response - ORJSON or Response Model
FastAPI docs for Response Model
cc: @ntkathole