Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
Closed
Description
Description
This is a very minor question on chosen syntax. Why not use the return type annotation for the response_model? For example rather than:
@app.post("/items/",response_model=Item)asyncdefcreate_item(*,item:Item):returnitem
You could concievably go:
@app.post("/items/")asyncdefcreate_item(*,item:Item)->Item:returnitem
which just seems like it uses the language facilities better and is a bit more pythonic. There is no real change in feature set, and I am sure i was thought of, but what was the reasoning behind not doing it?