Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upInclude all annotated fields in order #715
Conversation
This comment has been minimized.
This comment has been minimized.
codecov
bot
commented
Aug 5, 2019
•
Codecov Report
@@ Coverage Diff @@
## master #715 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 15 15
Lines 2710 2807 +97
Branches 532 578 +46
=====================================
+ Hits 2710 2807 +97 |
This comment has been minimized.
This comment has been minimized.
please can you rebase and move the history change to |
This comment has been minimized.
This comment has been minimized.
as per #716 I guess we should implement |
otherwise looks good, plus |
name=var_name, | ||
value=value, | ||
annotation=annotations.get(var_name), | ||
class_validators=vg.get_validators(var_name), | ||
config=config, | ||
) | ||
new_fields_ordering = [k for k in annotations if k in new_fields] + [ |
This comment has been minimized.
This comment has been minimized.
samuelcolvin
Aug 8, 2019
Owner
new_fields_ordering = [k for k in annotations if k in new_fields] + [ | |
ordered_new_fields = [k for k in annotations if k in new_fields] + [ |
new_fields_ordering = [k for k in annotations if k in new_fields] + [ | ||
k for k in new_fields if k not in annotations | ||
] | ||
for k in new_fields_ordering: |
This comment has been minimized.
This comment has been minimized.
samuelcolvin
Aug 8, 2019
Owner
for k in new_fields_ordering: | |
fields.update(ordered_new_fields) |
I think.
This comment has been minimized.
This comment has been minimized.
dmontagu
Aug 8, 2019
•
Author
Collaborator
new_fields_ordering
only includes the keys, not the values; your modification above didn't change that, as far as I can tell. So ordered_new_fields
is a List[str]
, not a Dict[str, Field]
.
I'm happy to rename, but I couldn't come up with a way to get ordered_new_fields
to be a dict without making things ugly elsewhere. Let me know if you want me to try harder.
This comment has been minimized.
This comment has been minimized.
samuelcolvin
Aug 8, 2019
Owner
Humm, that's true sorry.
Rather than describe it all, i'll commit to your PR and you can change or remove it if it doesn't make sense.
This comment has been minimized.
This comment has been minimized.
samuelcolvin
Aug 8, 2019
Owner
take a look at d3b10e5, I think that's better than building the order wrong then rebuilding it right, but happy to change if I'm missing something.
This comment has been minimized.
This comment has been minimized.
@dmontagu kind of unrelated, but nowhere better to discuss: Could I have your email address? If you're not happy sharing it publicly, feel free to email s@muelcolvin.com. |
This comment has been minimized.
This comment has been minimized.
Sent you an email, let me know if you didn't get it. |
This comment has been minimized.
This comment has been minimized.
@dmontagu are you happy with this? If so I guess it can be merged. |
This comment has been minimized.
This comment has been minimized.
@samuelcolvin I'm good with it, feel free to merge once the checks re-pass. |
321cde0
into
samuelcolvin:master
dmontagu commentedAug 5, 2019
•
edited by samuelcolvin
Change Summary
Modifies field ordering so that all annotated fields occur in the order included.
Note: non-annotated fields still come last; this is probably unavoidable.
This is a subtly breaking change, so, if desired, should probably be part of 1.0.
Related issue number
Related to #674 #483 #203 #716
Checklist
HISTORY.rst
has been updated#<number>
@<whomever>