[community-group] YAML as an alternate format (#92)

drwpow has just created a new issue for https://github.com/design-tokens/community-group:

== YAML as an alternate format ==
The current design tokens spec is in JSON, and that’s great! Forgive me if this has been talked about already, but I’d like to propose YAML as an alternate format for design tokens specification.

One precedent for this is the [OpenAPI specification](https://swagger.io/specification/), arguably the most popular way to document APIs. It is great prior art on a time-tested specification format, and one of the things that’s led to its adoption (I think) is the ability to use either `schema.json` or `schema.yaml` formats. Adopters of OpenAPI can choose JSON or YAML—whichever they prefer—because perhaps one fits better with their tooling and in the end both produce identical results.

There has already been [a comparison of JSON vs YAML discussed in #1](https://github.com/design-tokens/community-group/issues/1#issuecomment-663158695). But that was asking _JSON **OR** YAML_, and I’d like to ask if _JSON **AND** YAML_ makes sense (with JSON remaining the default/preferred format as already decided). Borrowing some points from that comment, and expanding on it, here would be some of the advantages:

- Code generation with YAML is just as easy as JSON (in some circles YAML is preferred)
- YAML is friendlier to read and write with fewer extraneous characters
- YAML allows comments (JSON doesn’t)
- (opinion) More teams will adopt the design tokens spec if they can use whichever format they’re most comfortable with

Lastly, to the point about “JSON being better for APIs,” I would disagree, also citing OpenAPI returning YAML as a good example. [Whitespace weight becomes negligible when gzipped](https://css-tricks.com/the-difference-between-minification-and-gzipping/) which any good API response will do. Further, few—if any—systems should rely on design tokens at runtime so response time shouldn’t be a deciding factor in format; user composition should.

Again, forgive me if there was a discussion I missed, but I wanted to get peoples’ thoughts on this question I’ve had. Thanks so much to the people organizing this project together, and I’m already excited by the current direction and amount of thought that’s been put into it!

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/92 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 7 January 2022 19:12:55 UTC