jsoncrack.com
jsoncrack.com copied to clipboard
[BUG]: JSON Crack refuses to process documents with unresolved $schema
Issue description
Example code:
{
"$schema": "tag:example.com,2023",
"squadName": "Super hero squad",
"homeTown": "Metro Town"
}
In VS code I get the problem "Unable to load schema from 'tag:example.com,2023' [...]". And no output is shown. I think this treatment is incorrect because:
- The $schema property has no standardized meaning in normal JSON data documents. The key is like any other string. JSON-schema in particular is not part of the JSON standard.
- The $schema property in JSON-schema documents is supposed to identify the URI of the meta schema used for validating the schema. However,
- I didn't specify that this is a schema. The non-toy example that had this problem actually isn't a meta-schema but a normal data document. Even in JSON-schema, $schema has no defined meaning in data documents. I went with the convention of using $schema to identify the schema that applies.
- The $schema URI doesn't have to be resolvable according to the JSON-schema spec. This is crucial because it looks like at least the web editor can't resolve any schema from the WWW (tested with
"$schema": "https://geojson.org/schema/Geometry.json
but not in VS Code).
- I don't see the rationale for not visualizing JSONs that are invalid according to the schema implied by the unofficial $schema property. A warning that the file doesn't fit the schema should be enough. Or in this case a warning that the schema couldn't be resolved.
Media & Screenshots
No response
Operating system
Platform-independent. (jsoncrack.com/editor and VS Code, Linux and Windows)
Priority this issue should have
Low (slightly annoying)