8000 Addition of the "description" field · ndcolling/python-openapi-codec@154f08e · GitHub
[go: up one dir, main page]

Skip to content

Commit 154f08e

Browse files
authored
Addition of the "description" field
The handling of the "description" field is missing at this moment and this results in having documentation look like following: http://i.imgur.com/utkJS21.png The change allows the "description" field to be displayed.
1 parent 0ee3353 commit 154f08e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

openapi_codec/decode.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,22 @@ def _parse_document(data, base_url=None):
2727
name = _get_string(parameter, 'name')
2828
location = _get_string(parameter, 'in')
2929
required = _get_bool(parameter, 'required', default=(location == 'path'))
30+
description = _get_string(parameter, 'description')
3031
if location == 'body':
3132
schema = _get_dict(parameter, 'schema', dereference_using=data)
3233
expanded = _expand_schema(schema)
3334
if expanded is not None:
3435
expanded_fields = [
35-
Field(name=field_name, location='form', required=is_required)
36+
Field(name=field_name, location='form', required=is_required, description=description)
3637
for field_name, is_required in expanded
3738
if not any([field.name == name for field in fields])
3839
]
3940
fields += expanded_fields
4041
else:
41-
field = Field(name=name, location='body', required=True)
42+
field = Field(name=name, location='body', required=True, description=description)
4243
fields.append(field)
4344
else:
44-
field = Field(name=name, location=location, required=require 4F47 d)
45+
field = Field(name=name, location=location, required=required, description=description)
4546
fields.append(field)
4647
link = Link(url=url, action=action, fields=fields)
4748

0 commit comments

Comments
 (0)
0