aboutsummaryrefslogtreecommitdiff
path: root/tools/swagger2html.py
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-12 14:44:37 +1300
committerGitHub <noreply@github.com>2017-02-12 14:44:37 +1300
commit9fc8bdbe23dcbc478dbdfe6d12b6b1f93fb045d1 (patch)
tree58eeaa50c6de6d29f5e0bfee4b4e0a034f993a32 /tools/swagger2html.py
parent35f002d4e2883f8d6373ed8aa29f1c8456975dd6 (diff)
parent49bfc0f90243046e658775016d8461b5982817f0 (diff)
downloadtrackermap-server-9fc8bdbe23dcbc478dbdfe6d12b6b1f93fb045d1.tar.gz
trackermap-server-9fc8bdbe23dcbc478dbdfe6d12b6b1f93fb045d1.tar.bz2
trackermap-server-9fc8bdbe23dcbc478dbdfe6d12b6b1f93fb045d1.zip
Merge pull request #2902 from sunhoww/update_swagger
Update swagger with v3.10 changes
Diffstat (limited to 'tools/swagger2html.py')
-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']
)