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

Rework ETag: remove "ETag computed with API response data using another schema", allow decorating MethodView #394

Merged
merged 8 commits into from Oct 16, 2022

Conversation

lafrech
Copy link
Member

@lafrech lafrech commented Aug 16, 2022

This is an attempt to simplify the ETag feature.

The "compute ETag with API response data using another schema" case is a leftover from the past and I don't think it is relevant. Removing it reduces API surface, allows to simplify the code and makes the feature more understandable by the user.

Also, this change makes _generate_etag easier to override for users not happy with its implementation (see #393).

Finally, allow etag decorator to be applied to a whole MethodView at once (introducing _decorate_view_func_or_method_view that may be useful for #280 and #311).

There are still things I would like to improve in the ETag feature (like the fact that it is still not completely decoupled from the response decorator), but this iteration should be an improvement by itself.

@codecov
Copy link

codecov bot commented Aug 16, 2022

Codecov Report

Merging #394 (f396177) into master (e0a6bd8) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #394      +/-   ##
==========================================
- Coverage   99.87%   99.87%   -0.01%     
==========================================
  Files          13       13              
  Lines         817      813       -4     
  Branches      178      176       -2     
==========================================
- Hits          816      812       -4     
  Partials        1        1              
Impacted Files Coverage Δ
flask_smorest/blueprint.py 100.00% <100.00%> (ø)
flask_smorest/etag.py 100.00% <100.00%> (ø)
flask_smorest/response.py 100.00% <100.00%> (ø)
flask_smorest/utils.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lafrech lafrech changed the title Remove "ETag computed with API response data using another schema" mode Rework ETag: remove "ETag computed with API response data using another schema", allow decorating MethodView Sep 5, 2022
@lafrech lafrech merged commit 34852ee into master Oct 16, 2022
@lafrech lafrech deleted the rework_etag branch October 16, 2022 17:15
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.

None yet

1 participant