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

Don't let validators override values already set in the schema #911

Conversation

StopMotionCuber
Copy link
Contributor

This at least resolves the bug that I encountered in the workaround for this issue.
I have included a test case that validates that @extend_schema_field is working for custom URLFields, which it was not previously

@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Base: 98.70% // Head: 98.70% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (b067aff) compared to base (6b8f8e9).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #911   +/-   ##
=======================================
  Coverage   98.70%   98.70%           
=======================================
  Files          68       68           
  Lines        7964     7976   +12     
=======================================
+ Hits         7861     7873   +12     
  Misses        103      103           
Impacted Files Coverage Δ
drf_spectacular/openapi.py 97.69% <100.00%> (+0.01%) ⬆️
tests/test_extend_schema.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.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

tfranzel added a commit that referenced this pull request Mar 4, 2023
* fix non-functional test from #911

* Fix linting error

* Test that @extend_schema_field is working for custom URLFields

* Don't override schema validators in case they are already set

Co-authored-by: ruben <ruben.simons@web.de>
Co-authored-by: T. Franzel <tfranzel@users.noreply.github.com>
@tfranzel
Copy link
Owner

tfranzel commented Mar 4, 2023

merged by adb6a8e

sry this took a while. Your change is nice, but you tests were utterly useless. 😆

CustomURLField would have tested the change but was not used. The other field made zero difference to the test suite due to schema type == None. Fixed up the test and merged.

@tfranzel tfranzel closed this Mar 4, 2023
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