Skip to content
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

🎨(api) use Annotated instead of Query as the default value #589

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

wilbrdt
Copy link
Contributor

@wilbrdt wilbrdt commented Apr 12, 2024

Proposal

As FastAPI recommends in its documentation (https://fastapi.tiangolo.com/tutorial/query-params-str-validations/), it is preferable to use Annotated with Query instead of a Query default value.

On a side note, issue #556 is still open, as FastAPI does not yet allow to use custom objects as query parameters type (see fastapi/fastapi#10259).

@wilbrdt wilbrdt added this to the 5.0 milestone Apr 12, 2024
@wilbrdt wilbrdt self-assigned this Apr 12, 2024
Copy link
Member

@quitterie-lcs quitterie-lcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilbrdt wilbrdt force-pushed the structure/tests/pydantic-v2-and-polyfactory branch from e46e3b3 to de2d1d9 Compare April 16, 2024 08:24
@wilbrdt wilbrdt force-pushed the structure/tests/pydantic-v2-and-polyfactory branch 2 times, most recently from 8ebdca5 to 2f25e8b Compare April 19, 2024 15:17
Base automatically changed from structure/tests/pydantic-v2-and-polyfactory to main April 19, 2024 15:29
@wilbrdt wilbrdt force-pushed the replace-query-annotated branch 5 times, most recently from 793416b to 639425f Compare April 24, 2024 09:31
As FastAPI recommends in its documentation
(https://fastapi.tiangolo.com/tutorial/query-params-str-validations/), it is
preferable to use Annotated with Query instead of a Query default value.
@wilbrdt wilbrdt merged commit b71a0f7 into main Apr 24, 2024
24 of 25 checks passed
@wilbrdt wilbrdt deleted the replace-query-annotated branch April 24, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants