This repository was archived by the owner on Mar 18, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 8
8
from openapi_codec .decode import _parse_document
9
9
10
10
11
- __version__ = '1.1.3 '
11
+ __version__ = '1.1.4 '
12
12
13
13
14
14
class OpenAPICodec (BaseCodec ):
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ def _get_paths_object(document):
66
66
67
67
for operation_id , link , tags in links :
68
68
if link .url not in paths :
69
- paths [link .url ] = {}
69
+ paths [link .url ] = OrderedDict ()
70
70
71
71
method = get_method (link )
72
72
operation = _get_operation (operation_id , link , tags )
@@ -77,13 +77,19 @@ def _get_paths_object(document):
77
77
78
78
def _get_operation (operation_id , link , tags ):
79
79
encoding = get_encoding (link )
80
+ description = link .description .strip ()
81
+ summary = description .splitlines ()[0 ] if description else None
80
82
81
83
operation = {
82
84
'operationId' : operation_id ,
83
- 'description' : link .description ,
84
85
'responses' : _get_responses (link ),
85
86
'parameters' : _get_parameters (link , encoding )
86
87
}
88
+
89
+ if description :
90
+ operation ['description' ] = description
91
+ if summary :
92
+ operation ['summary' ] = summary
87
93
if encoding :
88
94
operation ['consumes' ] = [encoding ]
89
95
if tags :
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ def test_paths(self):
63
63
}
64
64
},
65
65
'parameters' : [],
66
- 'description' : '' ,
67
66
'operationId' : 'list' ,
68
67
'tags' : ['users' ]
69
68
}
@@ -75,7 +74,6 @@ def test_paths(self):
75
74
}
76
75
},
77
76
'parameters' : [],
78
- 'description' : '' ,
79
77
'operationId' : 'create' ,
80
78
'tags' : ['users' ]
81
79
}
You can’t perform that action at this time.
0 commit comments