perl-JSV
perl-JSV copied to clipboard
No way to extract all error messages separate
The error messages seem to be grouped into similar groups. E.g. all missing "required" properties. But the JSV::Result does not have a method to extract the properties in question.
schema:
'required' => [ 'firstName', 'lastName' ],
'properties' => {
'firstName' => { 'type' => 'string' },
'lastName' => { 'type' => 'string' },
'age' => {
'type' => 'integer',
'description' => 'Age in years',
'minimum' => 0
}
},
'type' => 'object'
object:
{ }
JSV::Result:
bless( {
'errors' => [
{
'schema' => {
'required' => [
'firstName',
'lastName'
],
'properties' => {
'firstName' => {
'type' => 'string'
},
'lastName' => {
'type' => 'string'
},
'age' => {
'type' => 'integer',
'description' => 'Age in years',
'minimum' => 0
}
},
'type' => 'object'
},
'schema_pointer' => '',
'pointer' => '',
'keyword' => 'required',
'message' => 'The instance properties has not required properties (missing: firstName, lastName)',
'instance' => {},
'schema_pointer_history' => []
}
],
'error' => ''
}, 'JSV::Result' );
The properties "lastName" and "firstName" should be stored somewhere in this result.