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

Handle http method names passed for views in DRF for correct schema generation #1075

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

jekel
Copy link

@jekel jekel commented Sep 16, 2023

DRF does not handle 'http_method_names' argument for as_view() constructor when returning allowed method names for a view/endpoint, so if you pass explicitly any, schema will be generated by all existing, not only allowed.
These changes below correctly handle this issue.

@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f31238e) 98.62% compared to head (df5a4fc) 98.58%.

❗ Current head df5a4fc differs from pull request most recent head 38507c6. Consider uploading reports for the commit 38507c6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1075      +/-   ##
==========================================
- Coverage   98.62%   98.58%   -0.05%     
==========================================
  Files          71       68       -3     
  Lines        8609     8483     -126     
==========================================
- Hits         8491     8363     -128     
- Misses        118      120       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jekel
Copy link
Author

jekel commented Nov 4, 2023

@tfranzel are there any chances that pull request will be accepted?

@tfranzel
Copy link
Owner

tfranzel commented Nov 4, 2023

@jekel yeah sorry, didn't have much time recently and this is a non-trivial change. I will thoroughly look at it asap.

@tfranzel tfranzel merged commit 38507c6 into tfranzel:master Dec 11, 2023
31 checks passed
@tfranzel
Copy link
Owner

sry this took so long to get merged.

I slightly changed theif because the initkwarg should be used if present, not just when truthy.
Otherwise excellent PR! 🚀 Thanks @jekel for the effort and the patience.

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

2 participants