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

Commit 8ad253a

Browse files
author
Alejo Arias
committed
fixed bug where an endpoint docuemented with its verbs would fail when only one verb is documented
1 parent eacd1d7 commit 8ad253a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

flask_swagger.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ def _parse_docstring(obj, process_doc, current_verb, verbs):
5050
indexes.sort()
5151
if indexes:
5252
if current_verb_index is not None:
53-
start = indexes[indexes.index(current_verb_index)]
54-
end = indexes[start+1] if start < len(indexes)+1 else None
53+
start_index = indexes.index(current_verb_index)
54+
end_index = start_index+1 if start_index+1 < len(indexes) else None
55+
current_verb_stop = indexes[end_index] if end_index else None
5556
# skip the verb line
56-
start += full_doc[start:end].find('\n')+1
57-
temp_doc = full_doc[start:end]
57+
current_verb_index += full_doc[current_verb_index:current_verb_stop].find('\n')+1
58+
temp_doc = full_doc[current_verb_index:current_verb_stop]
5859
# remove indentation
5960
first_line = temp_doc.split('\n')[0]
6061
indentation = len(first_line) - len(first_line.lstrip())

0 commit comments

Comments
 (0)