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

Commit

Permalink
nitpicking - same end result
Browse files Browse the repository at this point in the history
  • Loading branch information
atlithorn committed Nov 28, 2015
1 parent b1e9f4c commit 9097d9a
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions flask_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,20 @@ def spec():
"info": {
"version": "0.0.0",
"title": "Cool product name",
},
"paths": defaultdict(dict),
"definitions": defaultdict(dict)
}
}
# set defaults from template
paths = defaultdict(dict)
definitions = defaultdict(dict)
if template is not None:
for tkey, tval in template.items():
if tkey == 'definitions':
for k, v in tval.items():
output['definitions'][k] = v
if tkey == 'paths':
for k, v in tval.items():
output['paths'][k] = v
else:
output[tkey] = tval
output.update(template)
# check for template provided paths and definitions
for k,v in output.get('paths',{}).iteritems():
paths[k] = v
for k,v in output.get('definitions',{}).iteritems():
definitions[k] = v
output["paths"] = paths
output["definitions"] = definitions

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

0 comments on commit 9097d9a

Please sign in to comment.