-
Notifications
You must be signed in to change notification settings - Fork 301
Support formatting URL segments via new FORMAT_LINKS setting #876
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
Support formatting URL segments via new FORMAT_LINKS setting #876
Conversation
Codecov Report
@@ Coverage Diff @@
## master #876 +/- ##
==========================================
+ Coverage 97.74% 97.80% +0.06%
==========================================
Files 60 60
Lines 3319 3320 +1
==========================================
+ Hits 3244 3247 +3
+ Misses 75 73 -2
Continue to review full report at Codecov.
|
2bf580e
to
4776e2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. Great work! There are some small comments I've added otherwise the PR is shaping up nicely.
Concerning naming of FORMAT_LINKS
: I see that this could be misleading. But I can only come up with names which are really long and as the documentation states it well how it is used I think it is OK for me to leave it with this name (unless we come up with something better)
Thanks @sliverc for the review! I've addressed most of your feedback. The only outstanding item at this point is how to "inline" the urlconf in If you have any suggestions off the top of your head, I would be grateful to hear them. Otherwise, I'll try to look into it some more in the next week or so. Regarding setting names, what do you think of |
I've made the requested changes, and I believe this is ready for another review. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
Oh darn it, I forgot to change the name to what I had suggested in my other comment. @sliverc Thoughts on I can create a new PR if you're okay with changing the setting name to one of the two I suggested, just let me know. |
I think in the future if there are other parts of the urls being automatically determined by DJA the setting should be called It would be great if you could create a PR. Thanks. |
Will do, I'll have another PR up in the next day or two. |
Fixes #790
Description of the Change
Added new setting
JSON_API_FORMAT_LINKS
. This setting is used to inflect serializer properties (i.e., field names) on URLs specifically.This allows users to have different inflections for properties in JSON responses (using
JSON_API_FORMAT_FIELD_NAMES
, existing behavior) vs properties in relationship and related resource links (usingJSON_API_FORMAT_LINKS
, new behavior, previously no inflection was supported).I used
JSON_API_FORMAT_LINKS
as the setting name, but I feel it's very important we select a setting name that is as intuitive for users as possible. So, if we think this name could be improved, I'd love to discuss that here and then make a change once we have reached consensus.This is my first contribution to a Python project, so please rip this apart 😄 Note that I was able to run
black
,flake8
, andpytest
individually, but I was not able to gettox
to work, so I apologize in advance if I've missed something as a result.Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS