23andMe / Yamale

A schema and validator for YAML.
MIT License
672 stars 88 forks source link

null() validator can be confusing with none=False #94

Closed salu133445 closed 3 years ago

salu133445 commented 4 years ago

Hi,

I found that the null() validator can be confusing with none=False. Here is an example.

# Data
key: ~
# Schema
null(required=False, none=False)  # -> this will pass without throwing errors

One possible way is to state it clear in the documentation that none=False will simply be ignored for a null() validator. The other way is to raise an error during constructing the validator if none=False is set for a null validator.

Thanks.

mildebrandt commented 4 years ago

I think documentation is fine here. People can actually add any random keyword argument to the validator...we only pick up the valid ones and use them. If there's a bigger effort to validate all the constraints in a validator in the future, we can add this as one of the work items. Thanks!

mildebrandt commented 3 years ago

Closing due to lack of comments.