-
Notifications
You must be signed in to change notification settings - Fork 258
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
Modify urls for nested routers #251
Conversation
Codecov Report
@@ Coverage Diff @@
## master #251 +/- ##
==========================================
+ Coverage 98.32% 98.34% +0.02%
==========================================
Files 53 53
Lines 4233 4539 +306
==========================================
+ Hits 4162 4464 +302
- Misses 71 75 +4
Continue to review full report at Codecov.
|
@tfranzel Can we look at having this merged?, i am also hitting this issue. Many thanks |
i'm sorry that this fell off the waggon. i had an issue with some aspects and wasn't able to follow up on it. will give it another go |
sry this took so long, but as you probably figured yourself this is more complicated than it looks. i had to rebuild the change myself to get a decent understanding on whats going on here.
i prepared a separate PR #369 on top of this PR. @merll @kingy04 please review if those changes work for you. it is basically a simplification of this PR. waiting for feedback from you guys as i'm not a |
drf-spectacular uses the
coerce_path
method of the Django Rest Framework, replacingpk
path parameters withid
(or the appropriate primary key). When using thedrf-nested-routers
library for extending URL actions to related objects, auto-generated URL paths are created with{object_pk}
patterns.Since these are not valid fields on the queryet model, they require a manual definition of URL path parameters using
@extend_schema
. This PR replaces such_pk
suffixes with_id
(or the appropriate primary key), so that further introspection is also able to guess the parameter type.The included test is based on a manually-created URL path, since it seemed unnecessary to add nested-routers as a dependency just for this purpose.