8000 Include description, summary. Ensure methods are ordered. · ndcolling/python-openapi-codec@5d977d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d977d8

Browse files
committed
Include description, summary. Ensure methods are ordered.
1 parent 4c621c6 commit 5d977d8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

openapi_codec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from openapi_codec.decode import _parse_document
99

1010

11-
__version__ = '1.1.3'
11+
__version__ = '1.1.4'
1212

1313

1414
class OpenAPICodec(BaseCodec):

openapi_codec/encode.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _get_paths_object(document):
6666

6767
for operation_id, link, tags in links:
6868
if link.url not in paths:
69-
paths[link.url] = {}
69+
paths[link.url] = OrderedDict()
7070

7171
method = get_method(link)
7272
operation = _get_operation(operation_id, link, tags)
@@ -77,13 +77,19 @@ def _get_paths_object(document):
7777

7878
def _get_operation(operation_id, link, tags):
7979
encoding = get_encoding(link)
80+
description = link.description.strip()
81+
summary = description.splitlines()[0] if description else None
8082

8183
operation = {
8284
'operationId': operation_id,
83-
'description': link.description,
8485
'responses': _get_responses(link),
8586
'parameters': _get_parameters(link, encoding)
8687
}
88+
89+
if description:
90+
operation['description'] = description
91+
if summary:
92+
operation['summary'] = summary
8793
if encoding:
8894
operation['consumes'] = [encoding]
8995
if tags:

0 commit comments

Comments
 (0)
0