@app.get('/gifs/{gifId}', response_model=GifsGifIdGetResponse, tags=['gifs'])
def get_gif_by_id(gif_id: int = Path(..., alias='gifId')) -> GifsGifIdGetResponse:
"""
Get GIF by Id
"""
pass
TypeError: Object of type Path is not JSON serializable
In this case Path parameter is 'gifId' which isn't python convention, so fastapi_code_generator changes the param name to 'gif_id' (and ads alias='gifId')
@app.get('/gifs/{gifId}', response_model=GifsGifIdGetResponse, tags=['gifs'])
def get_gif_by_id(gif_id: int = Path(..., alias='gifId')) -> GifsGifIdGetResponse:
"""
Get GIF by Id
"""
pass
The problems can happen foe Path/Query param names if the name isn't lower cased (or if it contains '-' char probably..)
[ ] Preprocessing: lowercase json schema. Result should be (gifId -> r_gifid_r)
@app.get('/gifs/{r_gifid_r}', response_model=GifsGifIdGetResponse, tags=['gifs'])
def get_gif_by_id(r_gifid_r: int) -> GifsGifIdGetResponse:
"""
Get GIF by Id
"""
pass
store renamed variables (e.g. renamed["r_gifid_r"] = "gifId"
[ ] postprocessing in 'OpenAPI._get_params' where we revert the names
openapi_json
tools
TypeError: Object of type Path is not JSON serializable
In this case Path parameter is 'gifId' which isn't python convention, so fastapi_code_generator changes the param name to 'gif_id' (and ads alias='gifId')
The problems can happen foe Path/Query param names if the name isn't lower cased (or if it contains '-' char probably..)
[ ] Preprocessing: lowercase json schema. Result should be (gifId -> r_gifid_r)
[ ] postprocessing in 'OpenAPI._get_params' where we revert the names