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

Fix crash with read-only polymorphic sub-serializer. #542

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

ngnpope
Copy link
Contributor

@ngnpope ngnpope commented Sep 30, 2021

If all fields are read-only when using split requests the component is pruned from the registry and if no longer available. If that is the case, we should just skip that component.

If all fields are read-only when using split requests the component is
pruned from the registry and if no longer available. If that is the
case, we should just skip that component.
@codecov
Copy link

codecov bot commented Sep 30, 2021

Codecov Report

Merging #542 (579fbf8) into master (d0dfdb4) will decrease coverage by 0.02%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #542      +/-   ##
==========================================
- Coverage   98.71%   98.69%   -0.03%     
==========================================
  Files          57       57              
  Lines        6302     6343      +41     
==========================================
+ Hits         6221     6260      +39     
- Misses         81       83       +2     
Impacted Files Coverage Δ
tests/contrib/test_rest_polymorphic.py 98.64% <95.45%> (-1.36%) ⬇️
drf_spectacular/contrib/rest_polymorphic.py 94.73% <100.00%> (+0.61%) ⬆️
drf_spectacular/openapi.py 97.07% <0.00%> (-0.13%) ⬇️
tests/test_regressions.py 100.00% <0.00%> (ø)
drf_spectacular/plumbing.py 97.60% <0.00%> (+0.01%) ⬆️

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 d0dfdb4...579fbf8. Read the comment docs.

@tfranzel tfranzel merged commit 579fbf8 into tfranzel:master Oct 1, 2021
@ngnpope
Copy link
Contributor Author

ngnpope commented Oct 1, 2021

Thanks for the tidy up! Glad I was able to track this one down though 🙂

@tfranzel
Copy link
Owner

tfranzel commented Oct 1, 2021

nice find @ngnpope!

I also added a fix for PolymorphicProxySerializer, which had the same issue. Condensed down the test to that specific aspect only, as I had to do it again for the other case.

@ngnpope ngnpope deleted the fix-read-only-polymorphic branch October 1, 2021 08:25
@tfranzel
Copy link
Owner

tfranzel commented Oct 1, 2021

i see that you pretty much use all the features in spectacular. glad to see that! i'm quite amazed at how seasoned code that is likely used by a bunch of people still can contain simple bugs.

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.

2 participants