-
Notifications
You must be signed in to change notification settings - Fork 299
Preserve values from being formatted #420
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
Conversation
6131764
to
89d8445
Compare
Codecov Report
@@ Coverage Diff @@ ## master #420 +/- ## ========================================== + Coverage 92.6% 92.68% +0.08% ========================================== Files 54 54 Lines 2812 2858 +46 ========================================== + Hits 2604 2649 +45 - Misses 208 209 +1
Continue to review full report at Codecov.
|
89d8445
to
a8bdf10
Compare
Introduce `JSON_API_FORMAT_FIELD_NAMES` which preserves keys of values. `JSON_API_FORMAT_KEYS` still exists but is deprecated.
a8bdf10
to
3d7637b
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.
Did the existing format_keys() also format the values? I was not aware, but I see where it recurses down the tree.
Good that you've fixed it.
Uh oh!
There was an error while loading. Please reload this page.
Fixes #313
Description of the Change
According to Json API Spec should only field names (hence the name
JSON_API_FORMAT_FIELD_NAMES
) be specifically named resp. formatted. The value itself may contain any json value though and we should keep it as is.With the option
JSON_API_FORMAT_KEYS
all keys (incl. value keys) are formatted though. This leads to underscored keys of a attribute value in Django code (or even on the database when using JSONField)To fix this I have introduced
JSON_API_FIELD_NAMES
setting which preserves value from being formatted.JSON_API_FORMAT_KEYS
still works as before though for backwards compatibility but is marked deprecated.Checklist
CHANGELOG.md
AUTHORS