Skip to content
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

Respect JSON_SORT_KEYS in _generate_etag #305

Merged
merged 1 commit into from
Dec 14, 2021
Merged

Conversation

lafrech
Copy link
Member

@lafrech lafrech commented Dec 13, 2021

After all, there is no reason to force this here. Respecting the setting from Flask makes things more consistent with payload dump.

This change will affect users setting JSON_SORT_KEYS to False in that generated ETags will now differ if the order of the dict payload changes. This makes sense for a strong ETag.

There are more things I'd like to clean up in the ETag feature. We're doing too much in flask-smorest and we should rely more on Flask/Werkzeug. This is just an easy first step.

This could be considered a (minor) bug fix. And a (slightly) breaking change.

@codecov
Copy link

codecov bot commented Dec 13, 2021

Codecov Report

Merging #305 (02332d4) into master (6f8a1d7) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #305   +/-   ##
=======================================
  Coverage   99.87%   99.87%           
=======================================
  Files          14       14           
  Lines         793      793           
  Branches      169      169           
=======================================
  Hits          792      792           
  Partials        1        1           
Impacted Files Coverage Δ
flask_smorest/etag.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f8a1d7...02332d4. Read the comment docs.

@lafrech lafrech mentioned this pull request Dec 13, 2021
flask_smorest/etag.py Outdated Show resolved Hide resolved
Respect JSON_SORT_KEYS app setting.
@lafrech lafrech merged commit 73d0720 into master Dec 14, 2021
@lafrech lafrech deleted the respect_json_sort_keys branch December 14, 2021 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant