Skip to content

No way to extract all error messages separate #44

@nicolasfranck

Description

@nicolasfranck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions