json-schema-validator icon indicating copy to clipboard operation
json-schema-validator copied to clipboard

How to validate Property in Schema containing Custom Validator only

Open piyush-goel996 opened this issue 4 years ago • 1 comments

Hello @stevehu , Can you have a look at this please?

Below is the keyword that is given in the documentation of the custom validator. You can use GroovyKeyword like below: { "type": "object", "properties": { "someProperty": { "type": "string", "groovy": "SomeScript.groovy" }, "someOtherProperty": { } } } Is there any way to validate only someProperty against groovy validator and skip someOtherProperty validation?

Please let me know if its feasible.

Thanks, Piyush Goel

piyush-goel996 avatar Aug 12 '21 06:08 piyush-goel996

Yes, it is feasible. Please, make note, that the property in properties section is not equal to keyword, which you have to specify in the custom validator. So in your example, the keyword should be "properties". In that way, you will replace the default PropertiesValidator with your custom, where you are able to select the property to validate.

DaNizz97 avatar Sep 10 '21 14:09 DaNizz97