Closed pgierz closed 2 months ago
This looks promising for capturing user errors, just need some nice formatting:
if "rules" in data:
if not RULES_VALIDATOR.validate({"rules": data["rules"]}):
> raise ValueError(RULES_VALIDATOR.errors)
E ValueError: {'rules': [{0: [{'description': ['unknown field'], 'enabled': ['unknown field'], 'pipelines': ['unknown field']}], 1: [{'cmor_units': ['unknown field'], 'description': ['unknown field'], 'enabled': ['unknown field'], 'pipelines': ['unknown field']}], 2: [{'cmor_variable': ['null value not allowed'], 'enabled': ['unknown field']}], 3: [{'cmor_variable': ['null value not allowed'], 'pipelines': ['unknown field']}]}]}
This adds a collection of validators that can be run against the user supplied dictionaries to check for errors.
Closes #27