Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

sliverc
Copy link
Member

@slivercsliverc commentedApr 16, 2018
edited
Loading

Fixes#313

Description of the Change

According toJson API Spec should only field names (hence the nameJSON_API_FORMAT_FIELD_NAMES) be specifically named resp. formatted. The value itselfmay contain any json value though and we should keep it as is.

With the optionJSON_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 usingJSONField)

To fix this I have introducedJSON_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

  • PR only contains one change (considered splitting up PR)
  • unit-test added (not needed as only build change)
  • documentation updated (not needed as only build change)
  • changelog entry added toCHANGELOG.md
  • author name inAUTHORS

@slivercslivercforce-pushed therecursive_format_keys branch 3 times, most recently from6131764 to89d8445CompareApril 17, 2018 07:02
@codecov-io
Copy link

codecov-io commentedApr 17, 2018
edited
Loading

Codecov Report

Merging#420 intomaster willincrease coverage by0.08%.
The diff coverage is98.52%.

Impacted file tree graph

@@            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
Impacted FilesCoverage Δ
example/settings/dev.py100% <100%> (ø)⬆️
example/settings/test.py100% <100%> (ø)⬆️
rest_framework_json_api/parsers.py97.14% <100%> (ø)⬆️
rest_framework_json_api/renderers.py85.32% <100%> (ø)⬆️
example/tests/unit/test_renderers.py100% <100%> (ø)⬆️
example/tests/test_parsers.py100% <100%> (ø)⬆️
example/tests/test_generic_viewset.py100% <100%> (ø)⬆️
example/tests/test_model_viewsets.py100% <100%> (ø)⬆️
example/tests/unit/test_settings.py100% <100%> (ø)⬆️
example/api/resources/identity.py94.28% <100%> (ø)⬆️
... and3 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update028f191...3d7637b. Read thecomment docs.

@slivercslivercforce-pushed therecursive_format_keys branch from89d8445 toa8bdf10CompareJune 14, 2018 09:56
Introduce `JSON_API_FORMAT_FIELD_NAMES` which preserves keys of values.`JSON_API_FORMAT_KEYS` still exists but is deprecated.
@slivercslivercforce-pushed therecursive_format_keys branch froma8bdf10 to3d7637bCompareJune 14, 2018 13:01
@slivercsliverc requested a review fromn2ygkJune 14, 2018 13:06
Copy link
Contributor

@n2ygkn2ygk left a 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.

@n2ygkn2ygk merged commit79e7738 intodjango-json-api:masterJun 18, 2018
@slivercsliverc deleted the recursive_format_keys branchJune 18, 2018 14:46
@slivercsliverc mentioned this pull requestDec 16, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@n2ygkn2ygkn2ygk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

All attribute value keys inflected with underscore in parser
3 participants
@sliverc@codecov-io@n2ygk

[8]ページ先頭

©2009-2025 Movatter.jp