Expose getMatchingSchemas#47
Expose getMatchingSchemas#47aeschli merged 5 commits intomicrosoft:masterfrom ianchi:matchingSchemas
Conversation
|
Fixed error when no schema matches. |
|
@ianchi I'm very hesitant to make |
|
Hi @aeschi, I have a schema that has a custom keyword that triggers a custom validation logic. Having the matching schemas makes all this dead simple. This can be validated with custom keywords using Ajv, but it is really not useful for reporting document position of the error. I understand that it exposes some implementation details, but it allows to use it to easily extend functionality. Exposing some of jsonDocument functionality also allows me to easily add some custom hover info with the vscode extension, that is dependant on the schema of the cursor’s node |
|
Hi @aeschli, any chance of considering this? Or any other approach to leverage this service and be able to extend it to use it on custom validations an hoover info? |
|
Hi @ianchi , I pushed a commit that hides the inverted schema. Also I polished the code and added tests. If you can sign the CLA, then I can push the change. |
|
Hi @aeschli, Thanks! |
Expose a new method
getMatchingSchemasthat resolves the applicable schema for the document and return the matching schema for each document node.This is very useful for extending the functionality of the validator and adding custom keys.
I need to do some custom validation and exposing this simple function would make it super easy to implement.
Otherwise I'd need to duplicate a lot of code.