Live data from Hacker News

Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

news.ycombinator.com

11–20 of 179 posts

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#12
post #7

Soon 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.

It's not "at least", it's arguably a different approach to a similar, but not equal, problem of having data structure.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#13
post #11

Is this the right place to complain about lack of a native Date datatype in JSON? Also lack of inheritance support. (For example I want a way to specify that my json object should be deserialized as Dog not as Animal.)

No, it's not the right place.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#14
post #10
post #7

Soon 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.

I legit saw a team asking for a tool that does JSON -> JSON transformations at work. The XSLT for JSON vibes were almost too strong.

That's jq. At least useful for a lot of transformations.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#15

Here's my gripe with jsonschema... In most cases where I want to do some validation on JSON I find that I usually have a class/struct/object that represents the payload and I want to unpack JSON into it (or dump that class to JSON). Ultimately, there are already nice tools to do this (eg; marshmallow on the python side). So unless I'm crossing language boundaries writing a separate jsonschema and using that is more w…

Here's my gripe with random HN comments: this has nothing to do with stability guarantees of the specification or not, unless I'm missing something in your comment. You basically just saw "JSON Schema" and thought "Aha, JSON Schema, here is why I don't like it at all, regardless of why you started this conversation"

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#16

I have been trying to get anyone to use it since I discovered FasterXML/Jackson could generate it. I have not worked for an organization with public APIs. Not a single one of the APIs I work on is completely stable. Figuring out what our APIs do requires techniques from archeology, anthropology, and sociology.

I'm not sure, but I suspect the JSON Schema is better used on the problem formulation stage, not on reverse engineering stage. It's still rather simple tool, it can easily be confused and hide the intent - at the same time if you record your API syntax in form of JSON Schema, you at least have reasons for each JSON Schema feature you put into the spec.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#17
post #14
post #10

Earlier quoted context omitted.

I legit saw a team asking for a tool that does JSON -> JSON transformations at work. The XSLT for JSON vibes were almost too strong.

That's jq. At least useful for a lot of transformations.

A little different, but yeah. (If I'm not mistaken, xslt had a bit more of a defined language and way more formalism.)

That said, there are plenty of examples. JSONPath, JQ, Jolt...

I am not claiming that this is not useful. Just amused to see the wheel go around.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#18

Started using it for my site. Have a hard time navigating the docs and understanding the best types of schema for different purposes. Is there a great guide that anyone knows of?

This one is good - https://json-schema.org/understanding-json-schema/index.html .

I also found this site useful - https://cswr.github.io/JsonSchema/spec/grammar/ .

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#19
post #6

It really needs comments. Unfortunately it'll never be backwards compatible. It's very helpful for debugging

To me, saying that JSON - not JSON Schema - needs comments is like saying an array - the good old "int[3] foo = { 5, 6, 7 };" - needs comments. I'm sure there are ways to 1) use it profitably without comments and 2) add comments in non-invasive way if really needed.

Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees

#20
post #6

It really needs comments. Unfortunately it'll never be backwards compatible. It's very helpful for debugging

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.
Post reply on HN