News for hackers. Stuff that matters.
Re:JSON Schema bundling formalised by Waterluvian on Saturday September 11, 2021 @01:39AM (#28489666)
A possibly silly question about JSON Schema:

What’s with the emphasis on full URLs to describe where to find related schema? Are developers really assembling a bunch of related schema over the Internet instead of just coalescing them in one place for local use?

Maybe I just don’t understand the use case. Why would I ever want to make a client do a bunch of calls to URLs I don’t own rather than serving them up reliably and consistently at one time?

It feels to me like the idea is some utopia where independent resources everywhere provide schemas and you can start stitching them together. But it just feels… unrealistic and not what I’d actually want.

Is this actively realized today? Or does everyone just reference local schemas by relative file path like I do?

Re:JSON Schema bundling formalised by ether_at_cpan on Saturday September 11, 2021 @03:38PM (#28495156)
They don't have to be real URLs, but just URIs. That is -- the files don't have to be accessable on the network at those URIs -- you can just use these strings as identifiers, and load the files up manually as you need them.

In fact, the JSON Schema specification even says that identifiers are just URIs and the evaluator implementation need not be expected to have to load the documents from the network (ref. https://json-schema.org/draft/2020-12/json-schema-core.html#... and https://json-schema.org/draft/2020-12/json-schema-core.html#...)

Re:JSON Schema bundling formalised by cinaboniver on Saturday September 11, 2021 @01:49AM (#28489699)
To be clear, I don’t have a lot of experience with JSON schema, but recently I found myself needing to validate Azure ARM templates using json schema, and my god is the Microsoft provided schema insane. Go look for yourself: https://schema.management.azure.com/schemas/2019-04-01/deplo...

That’s the root schema definition, but there are many, many references within, and they go deep. I tried using the bundling tool mentioned in the article to bundle all the references schemas and it came out to 25MB, minified. But if you don’t bundle, then you are right, your tool has to crawl the document and make many more http calls to deref everything. It’s so frustrating to work with.

Re:JSON Schema bundling formalised by Waterluvian on Saturday September 11, 2021 @02:07AM (#28489752)
That thing is ridiculous. Surely they build it in a different language and render the result as json.