Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 9097d9a

Browse files
committed
nitpicking - same end result
1 parent b1e9f4c commit 9097d9a

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

flask_swagger.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,20 @@ def spec():
111111
"info": {
112112
"version": "0.0.0",
113113
"title": "Cool product name",
114-
},
115-
"paths": defaultdict(dict),
116-
"definitions": defaultdict(dict)
114+
}
117115
}
118-
# set defaults from template
116+
paths = defaultdict(dict)
117+
definitions = defaultdict(dict)
119118
if template is not None:
120-
for tkey, tval in template.items():
121-
if tkey == 'definitions':
122-
for k, v in tval.items():
123-
output['definitions'][k] = v
124-
if tkey == 'paths':
125-
for k, v in tval.items():
126-
output['paths'][k] = v
127-
else:
128-
output[tkey] = tval
119+
output.update(template)
120+
# check for template provided paths and definitions
121+
for k,v in output.get('paths',{}).iteritems():
122+
paths[k] = v
123+
for k,v in output.get('definitions',{}).iteritems():
124+
definitions[k] = v
125+
output["paths"] = paths
126+
output["definitions"] = definitions
129127

130-
paths = output['paths']
131-
definitions = output['definitions']
132128
ignore_verbs = {"HEAD", "OPTIONS"}
133129
# technically only responses is non-optional
134130
optional_fields = ['tags', 'consumes', 'produces', 'schemes', 'security',

0 commit comments

Comments
 (0)