Path(alias=) feature doesn't work if the alias has a hyphen in it #6188
Answered
by
jrobbins-LiveData
jrobbins-LiveData
asked this question in
Questions
-
First Check
Commit to Help
Example CodeThis route, based on Closed Issue https://github.com/tiangolo/fastapi/issues/131#issuecomment-1177187775, works, and shows how one can alias a path parameter.
@router.get("/api/users/{id}/profile/")
def user_profile(user_id: int = Path(None, alias="id")):
return {
"id": user_id,
"username": "johndoe"
}This route, using |
Beta Was this translation helpful? Give feedback.
Answered by
jrobbins-LiveData
Nov 14, 2022
Replies: 4 comments
-
|
Duplicate of #5281? |
Beta Was this translation helpful? Give feedback.
0 replies
This comment was marked as duplicate.
This comment was marked as duplicate.
-
|
Closing since this is a duplicate of #5281. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kludex
-
|
Thanks for the help here @JarroVGIT ! 🚀 I'm gonna go ahead and close this then. 🤓 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Closing since this is a duplicate of #5281.