[WIP] Introduce JSON validation through schemas #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a disclaimer, this is very much to be interpreted as a WIP feature right now, but I still wanted to get out the current results and iteratively improve upon them in order to get early feedback from people manually using the schemas.
This PR makes the first steps towards providing helpful support for the various proprietary JSON "formats" put forward by Mojang and other parties (such as Forge). Currently, the following formats are being worked on or finished (the paths correlate directly to what is matched by the schemas):
sounds.json
(first thing finished because it's a really simple format)blockstates/[file].json
(both Vanilla and Forge flavours)models/(item/block)/[file].json
recipes/**/[file].json
(only Vanilla and Forge types for now)advancements/**/[file].json
loot_tables/**/[file].json
Some early feedback would be appreciated and if somebody is familiar with the JSON Schema format, suggestions on how to improve mine would be great. Unfortunately, IntelliJ's built-in validator appears to be fairly fenced off code-wise, the only entrypoint I could find was the schema providers to add custom schemas, with no way to provide custom error messages of any kind.
This limitation may be addressed on a second PR I plan to make (which may or may not be worked on in parallel with this, depending on how easy it is), which aims to provide intelligent support for JSON editing, such as file referencing and (limited) registration validation.