News for hackers. Stuff that matters.
Re:Validating Kubernetes YAML for best practice and policies by shahsyed on Sunday August 09, 2020 @11:01AM (#24100028)
You're partially kidding but you're 100% right.

Someone in another thread mentioned using some LISP or LISP-like language to solve this problem.

Would something like TOML make things better here?

What would have been the solution?

Re:Validating Kubernetes YAML for best practice and policies by rgoulter on Sunday August 09, 2020 @12:53PM (#24100903)
Dhall is an example of a configuration language. Its programs must terminate. It aims for safety, claiming that it can support safe evaluation of untrusted code. https://dhall-lang.org/

TBH, I have no experience with it. But, it sounds like if you need a configuration language with programmatic features, it would be more suited to the job than a general purpose programming language.

Re:Validating Kubernetes YAML for best practice and policies by pjmlp on Sunday August 09, 2020 @11:18AM (#24100107)
XML, but I guess I won't get many friends for asserting that.
Re:Validating Kubernetes YAML for best practice and policies by juped on Sunday August 09, 2020 @01:48PM (#24101374)
I really regret disliking XML all those years ago, now that I've seen the alternative.
Re:Validating Kubernetes YAML for best practice and policies by secondcoming on Sunday August 09, 2020 @11:38AM (#24100277)
Nope. Json has schema validation too, and every language has a json parser
Re:Validating Kubernetes YAML for best practice and policies by pjmlp on Sunday August 09, 2020 @11:44AM (#24100320)
JSON doesn't do comments.
Re:Validating Kubernetes YAML for best practice and policies by secondcoming on Sunday August 09, 2020 @12:16PM (#24100605)
Not officially, but it's fakeable
Re:Validating Kubernetes YAML for best practice and policies by pjmlp on Sunday August 09, 2020 @12:28PM (#24100694)
Which for me is a design smell, why bother with workarounds when XML already offers me all the best tooling out of the box.
Re:Validating Kubernetes YAML for best practice and policies by secondcoming on Sunday August 09, 2020 @09:23PM (#24104554)
For me, xml is just too much, and when working with C or C++ (not t sure about rust) it's just a pain. Can your json schema file not serve as the documentation?
Re:Validating Kubernetes YAML for best practice and policies by pjmlp on Monday August 10, 2020 @01:42AM (#24105938)
Why should it be a pain? Parsing XML is no different than parsing JSON, there are plenty of robust parsers available since around 2000.

Mature libraries with plenty of experience deploying into production.

Plus for small enough stuff, like configuration files, one can just plug XPATH as well, making the search for items even easier.

Re:Validating Kubernetes YAML for best practice and policies by jayd16 on Sunday August 09, 2020 @01:08PM (#24101027)
If something like k8s implemented comments as specific comment fields that would actually be pretty useful. The fields could be parsed and show in GUIs.
Re:Validating Kubernetes YAML for best practice and policies by secondcoming on Sunday August 09, 2020 @09:12PM (#24104487)
That is the workaround, just add it as "comment":"comment text". Having one comment for each field in an object would get unwieldy though. Anther place for them is possibly in the json schema file.
Re:Validating Kubernetes YAML for best practice and policies by jiangplus on Sunday August 09, 2020 @12:41PM (#24100798)
Then use HTML and extend the functionality with JSX
Re:Validating Kubernetes YAML for best practice and policies by pjmlp on Sunday August 09, 2020 @01:13PM (#24101064)
Useless work when XML already has all the tooling available and battle tested in production.