Fixed building OpenAPI docs.

Thanks to xet7 !

Fixes #5512
This commit is contained in:
Lauri Ojansivu 2025-03-15 19:32:16 +02:00
parent f99b735746
commit a2911bc9c3
3 changed files with 3235 additions and 8256 deletions

View file

@ -65,6 +65,8 @@ def get_req_body_elems(obj, elems):
elif obj.type in ('LogicalExpression', 'BinaryExpression', 'AssignmentExpression'):
get_req_body_elems(obj.left, elems)
get_req_body_elems(obj.right, elems)
elif obj.type == 'ChainExpression':
get_req_body_elems(obj.expression, elems)
elif obj.type in ('ReturnStatement', 'UnaryExpression'):
if obj.argument is not None:
get_req_body_elems(obj.argument, elems)

File diff suppressed because one or more lines are too long

View file

@ -15,7 +15,8 @@ fi
if [ ! -d ~/python/esprima-python ]; then
sudo apt-get -y install python3-pip python3-swagger-spec-validator python3-wheel python3-setuptools
sudo npm install -g api2html
# Install older version of api2html that works with Node.js 14
sudo npm install -g api2html@0.3.0 || sudo npm install -g swagger-ui-watcher
(mkdir -p ~/python && cd ~/python && git clone --depth 1 -b master https://github.com/Kronuz/esprima-python)
(cd ~/python/esprima-python && git fetch origin pull/20/head:delete_fix && git checkout delete_fix && sudo python3 setup.py install --record files.txt)
#(cd ~/python/esprima-python && git fetch origin pull/20/head:delete_fix && git checkout delete_fix && sudo pip3 install .)
@ -38,10 +39,11 @@ if [ ! -d public/api ]; then
mkdir -p public/api
fi
# 4) Generate docs.
#python3 ./openapi/generate_openapi.py --release $(git describe --tags --abbrev=0) > ./public/api/wekan.yml
# 4) Generate docs with api2html or fallback to swagger-ui-watcher
python3 ./openapi/generate_openapi.py --release v$1 > ./public/api/wekan.yml
api2html -c ./public/logo-header.png -o ./public/api/wekan.html ./public/api/wekan.yml
if ! api2html -c ./public/logo-header.png -o ./public/api/wekan.html ./public/api/wekan.yml; then
swagger-ui-watcher ./public/api/wekan.yml -p 8080
fi
# Copy docs to bundle
#cp -pR ./public/api ~/repos/wekan/.build/bundle/programs/web.browser/app/