aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorjon-stumpf <jon.stumpf@gmail.com>2017-02-20 10:54:34 -0500
committerjon-stumpf <jon.stumpf@gmail.com>2017-02-20 10:54:34 -0500
commit888c392af40187f3a0ecc3395495db9acd85b827 (patch)
treebeb74dff8b8052ffb4a7d3c894b2b4e5a4434973 /tools
parent38249673287b908c0ca55847a35ca16a7b6a0c50 (diff)
parent2449895139fa658d082c1085185003a001225bc3 (diff)
downloadtrackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.gz
trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.bz2
trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.zip
Resolved conflict with master;
Diffstat (limited to 'tools')
-rwxr-xr-xtools/swagger2html.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/swagger2html.py b/tools/swagger2html.py
index a3488835c..1121f04c9 100755
--- a/tools/swagger2html.py
+++ b/tools/swagger2html.py
@@ -224,11 +224,17 @@ def make_responses_table(responses):
except KeyError as e:
handleException('KeyError', e)
+def sorted_by_method(section):
+ sorting_function = lambda x: [ 'GET', 'POST', 'PUT', 'DELETE' ].index(
+ x['title'].split(' ')[0]
+ )
+ return sorted(sorted(section), key=sorting_function)
+
def make_paths(sections, json_data):
md = '<h2><a name="paths"></a>Paths</h2>\n'
for key in sorted(sections):
md += '<h3><a name="paths_{0}"></a>{0}</h3>\n'.format(key)
- for section in sections[key]:
+ for section in sorted_by_method(sections[key]):
md += '<h4><a name="{}"></a><code>{}</code></h4>\n'.format(
section['href'], section['title']
)
@@ -256,7 +262,7 @@ def make_contents(path_section, json_data):
for key in sorted(path_section):
md += ' <li><a href="#paths_{0}">{0}</a>\n'.format(key)
md += ' <ul>\n'
- for section in path_section[key]:
+ for section in sorted_by_method(path_section[key]):
md += ' <li><a href="#{}">{}</a></li>\n'.format(
section['href'], section['title']
)