$ref Custom Json schema not resolving path

Answered

I have a custom JSON schema with $ref as one of the property , I am expecting it to resolve paths but it doesn't where as without using a custom schema it works .

The below is an example when I'm using a Custom Schema .

 

The below is when I'm creating a schema itself 

 

Could you please help me with the above , also would wan't to know if I'm missing anything ?

0
9 comments

Hi,

Please provide us with more information. What extension points do you use? What are their implementations?

Also, how this topic differs from this one?
https://intellij-support.jetbrains.com/hc/en-us/community/posts/4723883357458-JavaScript-JsonSchema-ProviderFactory-extension-does-not-ref-to-a-schema-in-another-file-

0

I'm using the JavaScript.JsonSchema.ProviderFactory and inside the custom schema , I'm having a property $ref which is of type "uri-reference" 

I'm implementing the 

JsonSchemaProviderFactory

I'm expecting it to throw a warning/Error in case the reference File is not Valid .

Whereas , https://intellij-support.jetbrains.com/hc/en-us/community/posts/4723883357458-JavaScript-JsonSchema-ProviderFactory-extension-does-not-ref-to-a-schema-in-another-file-

I'm writing a Custom Json Schema , inside which I want to refer another schema inside another file  , which is used by the  JavaScript.JsonSchema.ProviderFactory   , but the Schema  in another file is not getting referred.

0

Sorry, but I don't understand your case.

What is expected behavior on the first screenshot? Should it be completed at the "../s" position, but it is not? What is the full context of the "$ref" attribute? Is it correct?

It would be better if you provide the plugin code and sample project because with the current information it is hard to understand what is the issue.

0

In the ../ place I'm expecting Intellij to provide Suggestions of the  files present in that folder , It doesn't in case of a custom schema with $ref as key .

However will provide the sample project .

0

Upload ID - 2022_03_21_TAYF3ARDSXvPBJzk

I have a schema with property $ref , I'm expecting intellij to validate (The file path given as value to $ref) the $ref in case of my Custom Schema as well , but it is not working .

0

Thank you for providing the plugin source. It is still unclear what's the issue.

Please provide an example project that we can run the plugin on. It should contain exact files you observe the issue for, with detailed instructions on how to reproduce it.

0

Sample project for plugin to run on : Upload id: 2022_03_25_7RB1rzPSq5fxDX69 (file: sample-project.zip)

The Plugin uses the JsonSchemaProvider Factory extension and contains a schema which validates against the json files whose path contains /endpoints.

Inside the sample project there is a file called sample.json which needs to be validated.

Run the plugin and open the sample project  , and sample.json file .

Inside the schema I have a property "$ref" which I want to validate file paths , hence the format is 'ur-reference'

Sample.json

I'm trying to add a property $ref  and when I type the value I'm expecting it to show all the file suggestions in that directory , but it is not working as expected .

i.e Unresolved schema references is not working in the case

 

0

I understand that your sample plugin contains a single JSON file with "$ref" property where you expect to complete what? There are no other files in this project/directory, so what do you expect to be completed? If you expect to have your transformationSchema.json to be completed, then I don't think it is possible this way. As far as I understand $ref can refer other available schemas, but transformationSchema.json is not exposed in any way and is not even registered/detected as schema.

I don't understand what exactly are you trying to achieve and if it is even correct in the context of JSON schema. I'm sorry but I can't help you and suggest debugging completions, resolutions etc. in the JSON schema mechanism.

0

So only other schema files can be referenced right ?

Is there any way in Intellij , where we can reference all '$ref' properties in json files ?

0

Please sign in to leave a comment.