bitops
bitops copied to clipboard
bitops.config.yaml should be validated against the schema
Following the https://github.com/bitovi/bitops/pull/236
While having a config schema, looks like we don't do a proper validation for plugins config bitops.config.yaml
.
Example nonsense yaml config:
bitops:
a: b
c: d
fail_fast: true
d:
e
logging:
level: foo
color:
enabled: maybe
Should be validated properly against the config schema and error in every place with a clear error message as users will naturally create typos, wrong copy-paste or invalid configs and the error messages they might get now are confusing.
In addition to this we should move the defaults for these config values into the schema and out of the core.
For python schema/config validation the conventional choices are:
- https://json-schema.org/ is a commonly used standard across the projects irrespective of programming language
- https://github.com/python-jsonschema/jsonschema 4K ⭐️
- Example: https://stackoverflow.com/a/22231372/4533625
- Example schema: https://github.com/StackStorm/st2/blob/master/st2common/st2common/util/schema/action_output_schema.json
- Python
schema
lib is another alternative- https://github.com/keleshev/schema 3K ⭐️
- Examples: https://www.andrewvillazon.com/validate-yaml-python-schema/