Re:Ask HN: Do you use JSON Schema? Help us shape its future ...
by jamesappledev on Monday January 30, 2023 @07:18PM
(#34588861)
We already use comments in JSON without JSONC in lots of projects.
Adding a { "//": "My Comment" } line works and most API's ignore excess fields.
[ Parent
| on HN ]
Re:Ask HN: Do you use JSON Schema? Help us shape its future ...
by Taywee on Tuesday January 31, 2023 @01:19AM
(#34591896)
A good json schema validator will usually reject excess fields.
Re:Ask HN: Do you use JSON Schema? Help us shape its future ...
by relequestual on Tuesday January 31, 2023 @05:42AM
(#34593563)
Actually, currently, this is not the case.
The specification explicitly allows for additional fields for the purposes of extensions.
We are considering changing that, and only allowing pre-defined fields, or having a way to mark specific fields as limited extensions.
Re:Ask HN: Do you use JSON Schema? Help us shape its future ...
by Taywee on Tuesday January 31, 2023 @04:19PM
(#34602317)
Huh, you're right. There is additionalProperties, but I mistakenly thought `"additionalProperties": false` was the default.
Re:Ask HN: Do you use JSON Schema? Help us shape its future ...
by relequestual on Wednesday February 01, 2023 @06:11AM
(#34609028)
It is not =]
Additionally, the value is a "schema" as opposed to a boolean, meaning you can apply a subschema to any additional fields. Useful if you for instance want to make sure any additional fields start with a specific prefix.
Booleans are valid schemas. It's subschemas all the way down! I wrote an article around this topic: https://json-schema.org/blog/posts/applicability-json-schema...