customized validation report and rules

178 views
Skip to first unread message

Tianyi XING

unread,
Sep 18, 2015, 8:00:10 PM9/18/15
to json-schema-validator

 

I am using the JSON schme validator to validate the JSON String. https://github.com/fge/json-schema-validator

I am following few tutorial to setup the prototype like here http://wilddiary.com/validate-json-against-schema-in-java/

It is running, but I have a question about the validation logic, I am using the data (json data to be validated and json schema) listed at the bottom of this page to test.

http://json-schema.org/example1.html

While I have the following questions:

  1. If I delete any key which is required, like price, the error message only listed this issue, even if I have many other errors like "id is being a String not the Integer as defined in JSON Scheme". How come ?

  2. How can I change the logic of the validation report generation ? like generate all or make them as different level, like error or warning, and customize it ?

  3. What is the good place to create my own validation rule ?  is there a way I can make a conditional validation, like if "key-a" = "true" in the json data to be validated, then I want "key-b" = 111, something like that ?

Thanks very much for answering in advanced.

Reply all
Reply to author
Forward
0 new messages