zfcampus / zf-apigility-documentation

BSD 3-Clause "New" or "Revised" License
12 stars 34 forks source link

Does not support nested elements #23

Closed YonmaN closed 9 years ago

YonmaN commented 9 years ago

A nested resource is one which is described by nested objects such as:

{
  'id': 1,
  'email': 'email@email',
  'address': {
    'street': '....',
    'zipcode': '....'
  }
}

This example is trivial but it is not a stretch to come up with other more plausible scenarios. Current implementation of the Field class and the ApiFactory class do not provide for such resource structure.

This limit extends to apigility-documentation-swagger which can be expected to display complex structures, as it is supported in other platforms.

The inputFilter class supports validation for a nested structure, so the capabilities do exist.

'input_filter_specs' => array(
       *'contact'* => array(
                *'type' => 'Zend\InputFilter\InputFilter',*
                'email' => array(
                    'name' => 'email',
                    'required' => false,
                    'validators' => array(
                        0 => array(
                            'name' => 'Zend\\Validator\\EmailAddress',
                            'options' => array(),
                        ),
                    ),

                    'description' => '',
                    'allow_empty' => false,
                    'continue_if_empty' => false,
                ),
            ),
    )
)