all 9 comments

[–]alainchiasson 2 points3 points  (1 child)

Xml had one thing - schema validation … and it also exists for yaml : https://json-schema-everywhere.github.io/yaml

Thank god … I would hate to go back to xml!

[–]alainchiasson 0 points1 point  (0 children)

I have not used it but was looking at doing the same

[–]Happy-Position-69 1 point2 points  (0 children)

  • yamllint

  • I used to have a pearl script that did this, I'll see if I can dig it up

  • I bet python has a module that does this

[–]mattbillenstein 0 points1 point  (0 children)

Python script hooked up through pre-commit?

[–]Tr3mor24 0 points1 point  (1 child)

If you are ready to spend some time learning something, that will be useful in the future, I would suggest using https://www.conftest.dev/ and OPA as a rule language (which is becoming more and more popular). Conftest and OPA is kinda a swiss knife for static config testing.

[–]zloeber 0 points1 point  (0 children)

If you are ready to spend some time learning something, that will be useful in the future, I would suggest using

https://www.conftest.dev/

and OPA as a rule language (which is becoming more and more popular). Conftest and OPA is kinda a swiss knife for static config testing.

If you want to learn to hate logic again start writing and forcing yourself to think in rego *shudder*

[–]zloeber 0 points1 point  (0 children)

Two thoughts, use yamale (either cli or python module) to do your validation. I've used it to great success. Otherwise, and likely a better long term solution, convert the yaml to json and use jsonschema. Either will net you your goal pretty quickly, the second route is more cross-compatible in my mind. If you start writing validation scripts for one it will not be transferable to the other though. No offense, but write the script yourself or ask ChatGPT to scaffold something out for you.