Skip to content

Commit

Permalink
Add only field names to __fields_set__, to fix #517, tested with @sommd
Browse files Browse the repository at this point in the history
… tests in #518
  • Loading branch information
tiangolo committed May 14, 2019
1 parent a05cfa9 commit 31df355
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,12 @@ def validate_model( # noqa: C901 (ignore complexity)
)

value = _get_input_value(input_data, field.alias)
if value is not _missing:
fields_set.add(field.alias)
using_name = False
if value is _missing and config.allow_population_by_alias and field.alt_alias:
value = _get_input_value(input_data, field.name)
using_name = True
if value is not _missing:
fields_set.add(field.name)
if value is not _missing:
fields_set.add(field.name)

if value is _missing:
if field.required:
Expand Down

0 comments on commit 31df355

Please sign in to comment.