How do I programatically configure JSON Schema Mappings in preferences .

Answered

I am developing a plugin that uses the JSON Schema Mappings (Preferences->Languages &Frameworks->Schemas & DTD's ->JSON Schema Mappings), inorder to avoid the user adding the mappings by themselves , I want to add via the plugin such that the intellij instance using my plugin automatically validates against the json schema without the user including it .

Is there any way to include the schemas through code ?

0
9 comments

Hi,

Please take a look at JavaScript.JsonSchema.ProviderFactory extension point and JsonSchemaProviderFactory interface.

Also, see example implementations:
https://jb.gg/ipe?extensions=JavaScript.JsonSchema.ProviderFactory

It will not add JSON schema in settings but will allow your files to use the provided schema for validation and completion.

-2

Hi Karol ,

Thanks for the update .

Does the above also provides the solution to validate specific schemas for specific directories .

0

All links are broken

 

0

The first two links do work for me, and the third example was moved and can be easily found here:
https://github.com/JetBrains/intellij-community/find/master

by searching for the class name: ThemeJsonSchemaProviderFactory

I have updated the link in the previous post.

1

Thanks. That was really fast response

0

Karol Lewandowski JsonSchemaProviderFactory based solution doesn't seem to work. do you have any other suggestions? I am trying to achieve the same thing as OP. I have a set of JSON Schema and I want to configure them against set of files using a custom plugin.

0

Please sign in to leave a comment.