jpmckinney / validictory

🎓 deprecated general purpose python data validator
Other
240 stars 57 forks source link

apply_default_to_data should not rely on required_by_default #84

Closed rkrzr closed 9 years ago

rkrzr commented 9 years ago

Hi,

it seems that right now the option apply_default_to_data only works when required_by_default=False is passed to validictory.validate. Otherwise a RequiredFieldValidationError is thrown, even though a default is supplied. Wouldn't it make more sense to first apply the default values and then check whether all required fields are present?

The drawback of the current design is that you apparently can't use both apply_default_to_data=True and required_by_default=True at the same time, but this restriction seems unnecessary.