spec icon indicating copy to clipboard operation
spec copied to clipboard

[proposal] Support yaml as well as jsonc

Open fahhem opened this issue 2 years ago • 3 comments

Any interest?

Background: jsonc, aka "JSON with comments", while nicer than plain JSON, is still relatively new and doesn't have full ecosystem support yet. It also has some shortcomings shared with JSON, such as not accepting trailing commas in lists/objects (except on a per-parser exception basis).

yaml can be limited to a JSON equivalent in terms of data structures it supports, and all (or at least most) of the issues with it were allayed in 1.2+ versions of the spec (such as on being parsed as true when not quoted). It also reduces the need for as many quotes, commas, open and close braces, and first-class supports comments.

fahhem avatar Feb 21 '23 21:02 fahhem

I'm definitely in support of the proposal, there's a reason docker-compose uses yaml rather than json - It's a lot easier for humans to work with than JSON.

But would suggest dropping support for jsonc in favour of just yaml since supporting jsonc is bound to introduce some compatibility changes between clients, and isn't as widely used as YAML.

YAML 1.2 is a strict superset of JSON, so conversion/support of existing configs should be fairly straightforward whilst drastically improving the general developer experience.

We'd support the following naming conventions:

  • devcontainer.yaml
  • devcontainer.yml

Thoughts are more than welcome on this if there's a reason this isn't already the standard.

codebymikey avatar Oct 25 '24 08:10 codebymikey

I agree on YAML 1.2 yet Im fairly new to contributing. Are you suggesting renaming devcontainers from dev containers to in istead devcontainers.yaml?

That's what I get from reading your support, either that or Json being a superset of yaml makes the proposal more appealing. Id be willing to reconfig these settings they are straight forward enough

Alloneway30 avatar Oct 25 '24 09:10 Alloneway30

Are you suggesting renaming devcontainers from dev containers to in istead devcontainers.yaml?

No, not necessarily, I'm merely suggesting that the specs documentation is updated to support an alternative file format (YAML) for the same information. Similar to how the .prettierrc file format supports a range of formats based on an order of precedence.

I just require additional input from a core member of team e.g. @bamurtaugh regarding this (and potentially why it wasn't ever supported), and if the proposal is accepted, we can discuss whether we plan to promote .yml as the default format (given I'm assuming it'll still require some time for devcontainer clients to implement it)

codebymikey avatar Oct 25 '24 13:10 codebymikey