File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ def _parse_document(data, base_url=None):
12
12
paths = _get_dict (data , 'paths' )
13
13
content = {}
14
14
for path in paths .keys ():
15
- url = urlparse . urljoin ( base_url , path .lstrip ('/' ) )
15
+ url = base_url + path .lstrip ('/' )
16
16
spec = _get_dict (paths , path )
17
17
default_parameters = get_dicts (_get_list (spec , 'parameters' ))
18
18
for action in spec .keys ():
@@ -83,7 +83,7 @@ def _get_document_base_url(data, base_url=None):
83
83
Get the base url to use when constructing absolute paths from the
84
84
relative ones provided in the schema defination.
85
85
"""
86
- prefered_schemes = ['http ' , 'https ' ]
86
+ prefered_schemes = ['https ' , 'http ' ]
87
87
if base_url :
88
88
url_components = urlparse .urlparse (base_url )
89
89
default_host = url_components .netloc
Original file line number Diff line number Diff line change @@ -10,20 +10,16 @@ def generate_swagger_object(document):
10
10
11
11
return {
12
12
'swagger' : '2.0' ,
13
- 'info' : _get_info_object (document ),
13
+ 'info' : {
14
+ 'title' : document .title ,
15
+ 'version' : '' # Required by the spec
16
+ },
14
17
'paths' : _get_paths_object (document ),
15
18
'host' : parsed_url .netloc ,
16
19
'schemes' : [parsed_url .scheme ]
17
20
}
18
21
19
22
20
- def _get_info_object (document ):
21
- return {
22
- 'title' : document .title ,
23
- 'version' : '' # Required by the spec
24
- }
25
-
26
-
27
23
def _get_paths_object (document ):
28
24
paths = {}
29
25
@@ -142,8 +138,8 @@ def _get_responses(link):
142
138
on action / method type.
143
139
"""
144
140
template = {'description' : '' }
145
- if link .action == 'post' :
141
+ if link .action . lower () == 'post' :
146
142
return {'201' : template }
147
- if link .action == 'delete' :
143
+ if link .action . lower () == 'delete' :
148
144
return {'204' : template }
149
145
return {'200' : template }
You can’t perform that action at this time.
0 commit comments