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…
Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
21–30 of 179 posts
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#22Is 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.)
(dog){
"ears": [(ear){"side": "right"}, (ear){"side": "left"}]
{% this is a comment %}
}
Now we only have to invent attributes, and we can sell this XML skin to the enterprise JSON users.(This is only half sarcasm)
EDIT: Even Better, make comments a subtree by having a special type tag, like #. this way, (#,dog){...} can stay in the tree, but is ignored.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#23Earlier quoted context omitted.
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.
For a simple, most frequently used subset of jq a more modest, non-Turing-complete language of transforming strings could be created, so that for many useful cases one just need to provide such a string. Strictly for JSON -> JSON.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#24[1] https://www.umami.recipes [2] https://schema.org/Recipe [3] https://github.com/google/schema-dts
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#25Soon 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.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#26[0] my biggest gripe is it's not well defined what to do with multipleOf when the number isn't an exact integer.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#27I’m invested in it. I’m using it to provide implementation-specific validation of requests to/from a third party API.
I wish there was a good macOS editor or IDEA plugin for it with autocomplete etc. The static generators from examples are obscure, ugly, minimal, and can’t account for variations. It isn’t pleasant to write, it’s tedious and slow.
Nevertheless I’d rather write API validation this way, in a document, than in code.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#28Here'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…
Wonder in which language class members can have such JSON Schema requirements as "an integer which is a multiple of integer X" or "string which matches regexp R". Also not sure which other schema system is better than JSON Schema across many different features.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#29Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#30Is 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.)
We've used { "__type": "DOG" } as metadata flags in GraphQL and JSON API's for a long time.
I rarely see an API return anything other than an ISO8601 UTC datetime string anymore other than Xero's horrific .NET(?) string " /Date(1326480130277+1300)/"