How to get all errors from lua json schema validation

204 Views Asked by At

I am able to work with lua json schema validators like ljsonschema &rapidjason but noticed none of them give all the errors & they abort on the 1st error. Is it possible to get the complete list of errors if the input json has > than 1 validation issues ?

For ex: For a schema like

{
  "type" : "object",
  "properties" : {
     "foo" : { "type" : "string" },
     "bar" : { "type" : "number" } 
  }
}

The sample json : { "foo": 12, "bar": "42" } should give 2 errors. However, I get only 1 error property "foo" validation failed: wrong type: expected string, got number.

How can I get both the below errors:

  1. property "foo" validation failed: wrong type: expected string, got number
  2. property "bar" validation failed: wrong type: expected number, got string

in the same run ?

0

There are 0 best solutions below