diff --git a/sphinxcontrib/openapi/openapi20.py b/sphinxcontrib/openapi/openapi20.py index efd3a3d..953551d 100644 --- a/sphinxcontrib/openapi/openapi20.py +++ b/sphinxcontrib/openapi/openapi20.py @@ -111,7 +111,14 @@ def _convert(schema, name='', required=False): (prop in required_properties)) elif type_ == 'array': - _convert(schema['items'], name + '[]') + name = name.lstrip('.') + description = schema.get('description', '') + output.append(( + name, + '{type_} {name}:' + ' {description}'.format(**locals()))) + if schema['items'].get('type', 'any') not in ['string', 'number', 'integer', 'boolean']: + _convert(schema['items'], name + '[]') else: if name: @@ -227,7 +234,7 @@ def openapihttpdomain(spec, **options): if 'group' in options: groups = collections.OrderedDict( [(x['name'], []) for x in spec.get('tags', {})] - ) + ) for endpoint in paths: for method, properties in spec['paths'][endpoint].items(): @@ -239,7 +246,7 @@ def openapihttpdomain(spec, **options): method, properties, utils.get_text_converter(options), - )) + )) for key in groups.keys(): if key: @@ -258,6 +265,6 @@ def openapihttpdomain(spec, **options): method, properties, utils.get_text_converter(options), - )) + )) return iter(itertools.chain(*generators))