Live data from Hacker News

JSON Schema bundling formalised

json-schema.org

11–20 of 188 posts

Re: JSON Schema bundling formalised

#11
A yes. Because things like "integer" totally need to be abstracted away into another schema. Couldn't have given this DSL built-ins for the things that are... you know... built into JSON already.

Also bonus points for the apparent lack of shorthands, turning this language into a verbose word salad. I hope there's at least a line of reasoning that explains why some keys are prefixed with '$' and others aren't.

Great way to turn something as beautifully simple as JSON into something abhorrent.

Hey. You know what is better than JSON at being XML? XML.

Re: JSON Schema bundling formalised

#12
post #2

We've come full circle back to XML SOAP. We should consider restricting the registration of .org domains to actual non-profit organizations, and restricting the use of words like "schema" and "standard" to things that have been fully certified as such by internationally accredited engineering bodies. This doesn't add anything on-top of the tools we've had 40 years ago. We're stuck with this everywhere now, all thanks…

back to CORBA

> CORBA

Get off my lawn!

Re: JSON Schema bundling formalised

#14

A yes. Because things like "integer" totally need to be abstracted away into another schema. Couldn't have given this DSL built-ins for the things that are... you know... built into JSON already. Also bonus points for the apparent lack of shorthands, turning this language into a verbose word salad. I hope there's at least a line of reasoning that explains why some keys are prefixed with '$' and others aren't. Great w…

afaik there is no integer type in json but a numeric type, and most languages do have different numeric types.

Re: JSON Schema bundling formalised

#15
If someone tried to push this on my engineering team, they would be laughed out of my office and ridiculed for the idiocy of even suggesting such garbage.

The best factor of JSON is being a schema-less, human readable format. Imagine having someone present this monstrosity to you with a straight face, thinking it's a good use for JSON.

Re: JSON Schema bundling formalised

#16
post #3

I might be exceptionally dense, but it's hard for me to see practical applications for something like this. In the end, if you implement this in your application, you will have a mechanism to say "this input document is invalid". AND THEN WHAT? Your only option is to discard it. I'd rather live by the old maxim "be liberal in what you accept, and strict in what you produce". But perhaps I'm overlooking an important u…

I'm relatively often manually editing `package.json` files in npm projects - it's useful if my editor can highlight when I make a typo.

Re: JSON Schema bundling formalised

#17

If someone tried to push this on my engineering team, they would be laughed out of my office and ridiculed for the idiocy of even suggesting such garbage. The best factor of JSON is being a schema-less, human readable format. Imagine having someone present this monstrosity to you with a straight face, thinking it's a good use for JSON.

Would a library that validates conformance to the schema so that you don't have to handcraft error handling sweeten the proposition?

Re: JSON Schema bundling formalised

#18
I'd like to offer a contrasting opinion to all of the other currently negative comments: I've used JSON schema in the past to validate outside input and it was a pleasant and straightforward experience.

There are unfortunately no standard type declarations that I'm aware of, which is a pain, but tools exist to translate schema.org schemas[1] (I have not used this myself).

[1]: https://github.com/charlestati/schema-org-json-schemas

Re: JSON Schema bundling formalised

#19

If someone tried to push this on my engineering team, they would be laughed out of my office and ridiculed for the idiocy of even suggesting such garbage. The best factor of JSON is being a schema-less, human readable format. Imagine having someone present this monstrosity to you with a straight face, thinking it's a good use for JSON.

To be honest, i used json schema for auto generating layouts.

Eg. https://github.com/rjsf-team/react-jsonschema-form

Re: JSON Schema bundling formalised

#20
I generally prefer using JSON in my interactions, where possible.

That's because it is lightweight, and 99.9% of the data I'm transferring is scalar. JSON is basically "implied" for scalar types.

The good thing (if you want to call it "good") about XML, is Schema.

Schema is a "rock hard" contract. It is definite, empirical, unambiguous. When I am looking at an API, and it has a Schema, then I know that I can figure out exactly what shape the data will take/emit.

If possible, I still use JSON for the exchange. I just use the XML to figure out the specifics in the exchange.

I've been working in XML forever, it seems. I've done ONVIF stuff, which is SOAP/WSDL-based, and even XSLT.

I still like JSON.

Mostly because I don't have to deal with Schema.

Over the years, I've gotten fairly good at developing XML Schemas, but I have never gotten "used" to it, and still have to look everything up.

If I develop APIs, I will often do an XML variant, alongside the JSON, because that forces me to write a Schema. Doing this, helps me to "code review" my schema, and also gives me a very convenient automated test hook.

But, boy, I still hate XML Schema...

Post reply on HN