Open exterm opened 1 year ago
Our problem would be solved by either restoring the way record_errors
worked before, or adding an option that makes validate
return the error objects, or by adding an option to omit the (generated) schema URI from the error messages.
I'm happy to put up a PR but am not sure which solution is preferred.
It seems that in version 4.1.1,
JSON::Validator#validation_errors
always returns[]
. I think it's due to the@errors
attribute being reset during validation: https://github.com/voxpupuli/json-schema/blob/76ea712a7fb444b738abbdc35295a6ccbd8d69e4/lib/json-schema/validator.rb#L126 .To reproduce:
We previously used
validation_errors
to get to the error objects and be able to call.message
on them, which yields a nicer error message for anonymous schemas (without URI). Now that seems no longer possible, and in addition thevalidation_errors
method seems useless.