-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Resolve route ambiguity for /tasks/activity endpoint #1924
Conversation
One thing that is key to account for here is the route ordering in the xxx_routes.py file! For example a The routes are resolved in order in the file, so if they were the other way around then FastAPI would try to load: Something like this could be happening here π |
Yes, you are right. The actual issue is due to the ordering of endpoints. In addition to ordering, we need to define distinct endpoints with trailing slash '/' in every endpoint. What else would be the best approach to avoid this kind of issue? @spwoodcock Yes, we can maintain ordering and place endpoints with placeholders in the path following other endpoints. |
We should be sure to not use a trailing slash for endpoints, but instead ensure the ordering is correct π But note this is only ordering per router, so an alternative could be a different grouping of endpoints:
I digress π In summary, for now let's just fix the ordering! |
What type of PR is this? (check all applicable)
Related Issue
Describe this PR
This PR resolves a routing issue in the
/tasks/activity
endpoint. A trailing slash (/) was added to the endpoint definition to ensure unambiguous route matching.Previously, the
/tasks/activity
route conflicted with the dynamic route/tasks/{task_id}
, causing the framework to misinterpret activity as a task_id, resulting in validation errors.Screenshots
N/A
Alternative Approaches Considered
Did you attempt any other approaches that are not documented in code?
Review Guide
Notes for the reviewer. How to test this change?
Checklist before requesting a review
[optional] What gif best describes this PR or how it makes you feel?