Config Validator: schema_with_slug_keys (#20298)

* schema_with_slug_keys

* Update config_validation.py

* Update config_validation.py
This commit is contained in:
Johann Kellerman 2019-01-22 02:36:04 +02:00 committed by Paulus Schoutsen
parent 4b3cdb9f4e
commit 6511e11ec9
38 changed files with 66 additions and 66 deletions

View file

@ -329,6 +329,9 @@ def schema_with_slug_keys(value_schema: Union[T, Callable]) -> Callable:
def verify(value: Dict) -> Dict:
"""Validate all keys are slugs and then the value_schema."""
if not isinstance(value, dict):
raise vol.Invalid('expected dictionary')
for key in value.keys():
slug(key)
return schema(value)