You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

8 lines
259 B

  1. from fastapi.encoders import jsonable_encoder
  2. from pydantic import BaseModel
  3. from starlette.responses import JSONResponse
  4. def create_aliased_response(model: BaseModel) -> JSONResponse:
  5. return JSONResponse(content=jsonable_encoder(model, by_alias=True))