Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JSONSchema covers a lot of various schema needs and YAML is something a lot of developers are comfortable with. I know both of those technologies are not popular here in HN but YAML type-checked and editor-autocomplete-enabled using JSONSchema is a solid choice for configurations in my opinion.


Every time I see YAML used for any configuration I know I’m in a frustrating time. It’s particularly bad for build systems where there the feedback time can be so slow.


I agree it doesn't scale well as there are no loops/functions, but there's a lot of good tooling around YAML that other config languages lack:

- mature libs for most languages

- VScode plugin + Jsonschema for auto completion / schema checking

- yamllint to detect the languages footguns

- yq to query, update in place, and format while preserving comments and sorting keys from the CLI


true, but as name suggests jsonschema wasn't meant for yaml it's only because yaml is superset of JSON. the issue is that when you want or need to use something that is outside of JSON spec, like tags all your validation falls apart. also JSON schea validation is really basic, and while designing configuration format can often mitigate that, it's not very versatile.

another common thing is that sometimes you have to define multiple very similar sections in configuration that cannot be handled with yaml archors, eg I have repeated definition dozen times that changes only in 2 numbers that are deeply in structure and name string, and I need to repeat everything because of that and it's pita to modify all other parameters that need to be kept in sync

therefore I think this format looks really nice, although I'm concerned by loops that can be used there, is there possible to create simple config that takes ages to parse or consume very large amounts of memory?


Jsonschema is still json and yaml is absolutely not comfortable to work with. It’s only enough for simple configs. As soon as you have the urge to use a template you should replace it with something else.


I use jsonnet for templating and transformation and jsonschema for validation. Very happy with this combination. One big reason is that there are lot of libraries and codegen tools to choose from once you have the JSON generation pipeline (including schema generation) down.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: