Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
Comments
Fixing validator-caused incorrect output key order#637
Fixing validator-caused incorrect output key order#637tiangolo merged 3 commits intofastapi:masterfrom
Conversation
Fixesfastapi#630. The cloned field was added existing field validators before the fields themselves. This caused Python's default "ordered `dict`" behaviour to incorrectly output dictionary key/value pairs with all 'validated' fields first.
dmontagu commentedOct 21, 2019
Have you confirmed that this doesn't change the validation logic? Probably worth making sure validators still work on endpoints with a response model (maybe this is already tested in the existing tests). Pydantic has some metaprogramming magic that could mean the validators don't get set up properly if they aren't present during class initialization; I'm not sure. |
Fixesfastapi#630. The cloned field was added existing field validators before the fields themselves.This caused Python's default "ordered `dict`" behaviour to incorrectly output dictionary key/value pairs with all 'validated' fields first.
codecovbot commentedOct 22, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #637 +/- ##===================================== Coverage 100% 100% ===================================== Files 269 269 Lines 6823 6824 +1 =====================================+ Hits 6823 6824 +1
Continue to review full report at Codecov.
|
jaddison commentedOct 22, 2019
Yes, all of the endpoints in my projects have |
Uh oh!
There was an error while loading.Please reload this page.
Including 'reformatting' change introduced by `black`.
dmontagu commentedOct 22, 2019
Looks good to me! |
Uh oh!
There was an error while loading.Please reload this page.
A quick PR thatfixes#630. The cloned field was adding existing field validators before the fields themselves.
This caused Python's default "ordered
dict" behaviour to incorrectly output dictionary key/value pairs with all 'validated' fields first.