-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 Update code examples in docs for body, replace name create_item
with update_item
when appropriate
#5913
Conversation
📝 Docs preview for commit c9d3b22 at: https://63ccee9f0fb8da5c9c02fac2--fastapi.netlify.app |
📝 Docs preview for commit dc6946f at: https://63ccf0f8cf78ab6745a882e4--fastapi.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass.
The changes listed as "1" are good changes.
I understand the suggestion for "2", however I suggest not making those changes because that code is repeated in multiple places throughout the tutorials. As I understand the tutorials, they build on each other somewhat, and they focus on specific items in each section. It seems to me that making these changes in a few places adds inconsistencies that the learner has to investigate as they change. It may be more useful to keep it consistent even if the example isn't optimal?
@Ryandaydev First time when learner see this @app.get("/items/{item_id}")
async def read_items(q: str | None, item_id: int = Path(title="The ID of the item to get")):
results = {"item_id": item_id}
if q:
results.update({"q": q})
return results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the reasoning on this change. Also, the tests still pass.
📝 Docs preview for commit 2bfa458 at: https://64697a4de93dbc10f72678bd--fastapi.netlify.app |
Ok. I removed controversial changes and left only renamed functions |
create_item
with update_item
when appropriate
Nice, makes sense, thank you @OttoAndrey! 🍰 And thanks everyone for the input! ☕ |
Hi! I did some improvements for code exmples;
put
endpoint and logicaly it should beupdate
notcreate
;Removed redundantif
statement becauseq
param in those examples are required. Or I can addNone
to annotations;