summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-06-16 18:07:53 +0300
committerLauri Ojansivu <x@xet7.org>2020-06-16 18:07:53 +0300
commitab6ec59bfbac4b692ff65999545fd6920d0087e5 (patch)
tree281b969ccd6e86a31e7aea75fe13e1608c7e8ad5
parentb144fab042fd486d2ec3731b6cc286059002af7a (diff)
parent336a22555f7c6baf81587c6f10e818a7c1cdce90 (diff)
downloadwekan-ab6ec59bfbac4b692ff65999545fd6920d0087e5.tar.gz
wekan-ab6ec59bfbac4b692ff65999545fd6920d0087e5.tar.bz2
wekan-ab6ec59bfbac4b692ff65999545fd6920d0087e5.zip
Merge branch 'fix-docs' of https://github.com/bentiss/wekan into bentiss-fix-docs
-rw-r--r--openapi/generate_openapi.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/openapi/generate_openapi.py b/openapi/generate_openapi.py
index 54526416..b843feff 100644
--- a/openapi/generate_openapi.py
+++ b/openapi/generate_openapi.py
@@ -814,13 +814,21 @@ def parse_schemas(schemas_dir):
for d in data]
entry_points.extend(schema_entry_points)
+ end_of_previous_operation = -1
+
# try to match JSDoc to the operations
for entry_point in schema_entry_points:
operation = entry_point.method # POST/GET/PUT/DELETE
+
+ # find all jsdocs that end before the current operation,
+ # the last item in the list is the one we need
jsdoc = [j for j in jsdocs
- if j.loc.end.line + 1 == operation.loc.start.line]
+ if j.loc.end.line + 1 <= operation.loc.start.line and
+ j.loc.start.line > end_of_previous_operation]
if bool(jsdoc):
- entry_point.doc = jsdoc[0]
+ entry_point.doc = jsdoc[-1]
+
+ end_of_previous_operation = operation.loc.end.line
except TypeError:
logger.warning(context.txt_for(statement))
logger.error('{}:{}-{} can not parse {}'.format(path,