File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from openapi_codec .decode import _parse_document
99
1010
11- __version__ = '1.1.3 '
11+ __version__ = '1.1.4 '
1212
1313
1414class OpenAPICodec (BaseCodec ):
Original file line number Diff line number Diff 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
7878def _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 :
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ def test_paths(self):
6363 }
6464 },
6565 'parameters' : [],
66- 'description' : '' ,
6766 'operationId' : 'list' ,
6867 'tags' : ['users' ]
6968 }
@@ -75,7 +74,6 @@ def test_paths(self):
7574 }
7675 },
7776 'parameters' : [],
78- 'description' : '' ,
7977 'operationId' : 'create' ,
8078 'tags' : ['users' ]
8179 }
You can’t perform that action at this time.
0 commit comments