Ver Fonte

Fixed building OpenAPI docs.

Thanks to xet7 !

Fixes #5512
Lauri Ojansivu há 2 meses atrás
pai
commit
a2911bc9c3
3 ficheiros alterados com 9 adições e 6 exclusões
  1. 2 0
      openapi/generate_openapi.py
  2. 1 2
      public/api/wekan.html
  3. 6 4
      releases/rebuild-docs.sh

+ 2 - 0
openapi/generate_openapi.py

@@ -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)

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 2
public/api/wekan.html


+ 6 - 4
releases/rebuild-docs.sh

@@ -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/

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff