News for hackers. Stuff that matters.
Re:OpenAPI v3.1 and JSON Schema 2019-09 by westurner on Saturday February 29, 2020 @06:53PM (#22454093)
JSON5 supports comments: https://json5.org/
Re:OpenAPI v3.1 and JSON Schema 2019-09 by throwaway894345 on Saturday February 29, 2020 @08:37PM (#22454512)
But who supports json5?
Re:OpenAPI v3.1 and JSON Schema 2019-09 by hombre_fatal on Saturday February 29, 2020 @10:04PM (#22454846)
You can use json5 for comments and compile it to json.
Re:OpenAPI v3.1 and JSON Schema 2019-09 by CameronNemo on Saturday February 29, 2020 @10:29PM (#22454943)
You can use (yaml, hjson, jsonnet) for the same purpose. What sets json 5 apart?
Re:OpenAPI v3.1 and JSON Schema 2019-09 by Supermancho on Sunday March 01, 2020 @12:53AM (#22455364)
YAML, hjson and jsonnet do not validate existing json blobs. You can "use" ROT13 for the same purpose, but it's incidental in what you are trying to do.

I would plead that everyone stop using YAML. It's terrible at everything.

jsonnet is a template language for a serialization format. Who would choose that nightmare?

Ecmascript isn't big on extending the language orthogonally, so hjson is eventually going to be superceded by a ES*.

This is a niche concern that has an optimal path. Go with a validation schema designed for applying to a serialization format, which has widespread library support.

Re:OpenAPI v3.1 and JSON Schema 2019-09 by CameronNemo on Sunday March 01, 2020 @12:31PM (#22457921)
>YAML ... do not validate existing json blobs

YAML 1.2 is a strict superset of JSON. What do you mean by "validate" here?

>I would plead that everyone stop using YAML. It's terrible at everything.

Fair enough.

>jsonnet is a template language for a serialization format. Who would choose that nightmare?

People who are tired of Jinja2 and YAML but don't want to jump to a general purpose programming language?

>widespread library support

JSON5 is implemented in Javascript, Go, and C#. Not sure how "widespread" that is. Rust, C, Python, Lua, Java, and Haskell are missing out on the fun.

Re:OpenAPI v3.1 and JSON Schema 2019-09 by westurner on Sunday March 01, 2020 @07:50PM (#22460585)
When I searched for "JSON5 [language]", I found JSON5 implementations in/for Rust, C, Python, Java, and Haskell on the first page of search results.

I like YAML, but some of the syntax conveniences are gotchas: 'no' must be quoted, for example.