8000 Merge pull request #9 from andreyyudin/patch-1 · millerlucas/python-openapi-codec@ff8edb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff8edb6

Browse files
authored
Merge pull request core-api#9 from andreyyudin/patch-1
Addition of the "description" field
2 parents 0ee3353 + 154f08e commit ff8edb6

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=required)
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