json-schema
json-schema copied to clipboard
[Question] Is there a way to generate error output?
I am aware that the ValidationResult returned by validate() can contain a ValidationError.
Does this library provide a way to turn a ValidationError into an error text that can be shown to the user? Looks like generating such a message is somewhat involved, with ValidationError containing multiple potentially relevant fields, including subErrors. So I rather not reinvent the wheel here.
For my use cases this message does not need to be fancy or particularly user friendly. Something akin to a stack trace would work great and is miles better than just dumping a serialized version of ValidationError.
Something similar to https://www.php.net/manual/en/throwable.gettraceasstring.php
https://opis.io/json-schema/2.x/php-error-formatter.html