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

Use Annotated types for FastAPI db_session, get_current_user parameter #3192

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

wssheldon
Copy link
Contributor

Initial commit uses Annotated types for DispatchUser and Session in Case view as an example. If the approach looks good to folks (namely where the annotated types live in the codebase) I will add this approach to all the views for consistency.

Reference: https://www.reddit.com/r/Python/comments/11v0kcb/fastapi_0950_supports_and_recommends_annotated/

@wssheldon wssheldon added the enhancement New feature or request label Mar 30, 2023
@wssheldon
Copy link
Contributor Author

Looks like the * symbol at the beginning of the view functions can also be removed if we use Annotated types

https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#order-the-parameters-as-you-need-tricks

@wssheldon

This comment was marked as resolved.

Copy link
Contributor

@mvilanova mvilanova left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for working on it.

@wssheldon wssheldon merged commit 3d1ffb4 into master Mar 31, 2023
@wssheldon wssheldon deleted the enhancement/annotated-types-fastapi branch March 31, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants