Interesting Tool: Schema Enforcer
It looks like JSON Schema is the new black. Last week I wrote about a new Ansible module using JSON Schema to validate data structures passed to it; a few weeks ago NetworkToCode released Schema Enforcer, a similar CLI tool (which means it’s easy to use it in any CI/CD pipeline).
Wondering why schema validation matters? Start here. See also: GIGO.
Here are just a few things Schema Enforcer can do:
- Validate any YAML file against a JSON schema just by including a comment at the top of the YAML file (much better than my crazy pipeline including yq and a temporary file).
- Read JSON schema in YAML format. A beautiful addition for everyone who got squinty eyes from looking at too many curly braces.
- Validate Ansible inventory using schema(s) specified in additional Ansible variables or even based on variable names used in Ansible inventory.
Interested? It’s on GitHub – download it and make it work for you.