loganasherjones / yapconf

Yet Another Python Configuration
http://yapconf.readthedocs.io/en/stable/
MIT License
18 stars 4 forks source link

Custom Validators #43

Closed loganasherjones closed 6 years ago

loganasherjones commented 6 years ago

I want to be able to validate my config items. Something like the following

def my_validator(value):
  if value in 'bar':
    return False, "message"

SPEC = {
    'foo': {'validator': my_validator}
}

If the validator fails, then loading will fail.