Open gregsdennis opened 9 months ago
I was dissappointed to discover that JSON Schema bundling (aka 'Compound Schema Documents) as per the 2019-09 spec is not implemented yet.
This seems to be what the OP here is describing.
This would really help to deliver a reasonable solution for a system I'm working on. There is a large data model, described across ~540 schemas. These are maintained in seperate files, with '$ref' values specifiying relative paths to the relevant schemas files, and they're all published to a web hosting environment. Our end users create data files, with a '$schema' field to reference any one of these schema files. In the 'worst' case, which is also the most common, a data file references a 'top level' schema, which results in VS Code attempting to download all 540 schema files when the data file is opened in VS Code. We are regularly experiencing timeouts for at least one of these requests, which is not acceptable functionally or UX-wise in our case.
Compount Schema Documents is a perfect fit for our case.
While not the ideal solution, my JSON Schema CLI tool supports performing bundling without making use of identifiers to workaround Visual Studio Code limitations on this: https://github.com/Intelligence-AI/jsonschema/blob/main/docs/bundle.markdown.
Despite meager attempts to fix support for references to
$id
s, it still doesn't work.I expect it's trying to perform a web request to find the schema because this looks like a web address. However, per the specification, IDs are URIs: merely identifiers, not locators. If VSCode chooses to interpret URIs as locators, that's a decision it can make, but it should default to checking the workspace for
$id
s first.In instances identifying the schema
Technically, this isn't a JSON Schema feature because the specification can't dictate what goes in a JSON file, but VSCode claims to support it, so it should work.
In the image below, the error indicates that
https://example.com/schema
can't be found, even though it's defined in the workspace.Within schemas
In the image below, the error indicates that
https://example.com/foo
can't be found, even though it's clearly defined at/definitions/foo-def