We use JSON Schema, and we have had nary a problem with storing a bunch of JSON documents in a variety of no-SQL databases for many years now (knock on wood because yikes that a bold sentence to write). Making sure there aren't major breakages from one version to the next sure would be nice, yes. We hit some snags as we attempted to upgrade from I believe 4 to 7, especially because we'd have to deploy native apps int…
Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
121–130 of 179 posts
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#122I reviewed JSON Schema libraries for Haskell: https://github.com/sshine/library-recommendations/blob/main/... My current impression is that JSON Schema is nicer in theory than in practice.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#123Regarding explicit guarantees, I'd consider a "forward-compatible" way such that when - and if - a breaking change needs to be introduced, it's possible to automatically convert old JSON schemas into the new one. JSON Schema version which would select which processing to choose could be an option, but not sure if there couldn't be better. As is often the case, good domain knowledge can help to choose which features a…
Personally, I'd like to see it become officially supported. We have work to do!
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#124Earlier quoted context omitted.
Decimal types don't exist in JSON. If you need decimals, you definitely should encode them as strings. As JSONschema exists to document JSON, it should be agnostic to that. You can if you wish, provide format information in the format field, which is not prescriptive.
Neither binary nor decimal floating point types exist in the JSON spec. The JSON spec does not give an explicit internal representation for floating points, implementations are free to use decimal types internally, if they wish to do so. The JSON spec merely specifies what a "number" is at the grammar level. Having said that most implementations don't use decimal floating points to represent these.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#125Earlier quoted context omitted.
Zod schemas are the source of truth, from which TS types are inferred and JSON schemas are generated.
Interesting.. I'd rather write typescript types than Zod schemas. I haven't used JSON schema, but going TS to Zod was straightforward and really pleasant
Also if you start with objects you can express runtime conditions that are not possible with types, for example maximum sizes.
Zod is quite a bit more general than JSON schema because it can express transformations not just validations.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#126like you would expect that people realize "additionalProperties" are additional to "properties" but pretty much any doc or code gen tooling I have used has some problems with getting that right (various problem not always the same)
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#127Soon we'll have JSLT. JSON Query, JSON Pointer, JSON signatures etc are already there. And I say that as a conscious XML user. We are going in circles. At least XML has comments.
because one thing is for sure, json schema and openapi are not really nicely readable, even if written as yaml
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#128Soon we'll have JSLT. JSON Query, JSON Pointer, JSON signatures etc are already there. And I say that as a conscious XML user. We are going in circles. At least XML has comments.
JSON Schema is something that address stability guarantees for JSON - where JSON was invented to be easy to change so it skips heavy XML stuff that was giving stability guarantees.
Now people involved in JSON Schema have problem with decision on stability guarantees - if they skip those or keep it backwards compatible...
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#129Earlier quoted context omitted.
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.
A good json schema validator will usually reject excess fields.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#130No, but I don’t do much backend stuff, anymore.
I’m totally anal about Quality, so I want to do things like jsonSchema. I used to deliberately publish APIs in both JSON and XML, so that I could use XML Schema to validate the data, but JSON, to actually use it.
XML Schema is a huge PItA. I don’t like auto-generated Schema (see “anal,” above), so I tend to hand-tune (or write code to dynamically generate) my Schema.
The main reason I don’t use jsonSchema, is that I don’t have a real use for it, these days.
I mostly have internal APIs (proprietary backends), so there’s no need. I do have one backend that I recently wrote, that is public, and I may consider adding a published schema to it.