You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by li...@apache.org on 2020/12/01 05:07:28 UTC

[submarine] branch master updated: SUBMARINE-687. Create bash script to auto-generate typescript-sdk and fix minor bugs

This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 18b58f9  SUBMARINE-687. Create bash script to auto-generate typescript-sdk and fix minor bugs
18b58f9 is described below

commit 18b58f98b3ec75053d8fc206176497e9d4a17981
Author: ByronHsu <by...@gmail.com>
AuthorDate: Fri Nov 27 22:48:44 2020 +0800

    SUBMARINE-687. Create bash script to auto-generate typescript-sdk and fix minor bugs
    
    ### What is this PR for?
    It is a sub-task under [SUBMARINE-686. [Umbrella] Intergrate swagger to frontend](https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-686?filter=allopenissues)
    1. To integrate swagger to the frontend, I wrote a script to auto-generate typescript-angular sdk.
    2. Fix bug in `gen-sdk.sh`
    3. Improve doc
    
    ### How should this be tested?
    https://github.com/ByronHsu/submarine/actions/runs/386715559
    ### What type of PR is it?
    [Improvement]
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-687
    
    Author: ByronHsu <by...@gmail.com>
    
    Closes #464 from ByronHsu/SUBMARINE-687 and squashes the following commits:
    
    dc8adbd [ByronHsu] Remove comments
    f7a8468 [ByronHsu] create gen-ts-sdk and fix minor bugs
---
 dev-support/pysubmarine/gen-sdk.sh                    |  1 +
 dev-support/pysubmarine/{gen-sdk.sh => gen-ts-sdk.sh} | 19 ++++---------------
 docs/submarine-sdk/pysubmarine/development.md         |  2 +-
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/dev-support/pysubmarine/gen-sdk.sh b/dev-support/pysubmarine/gen-sdk.sh
index 4647e76..b83eab1 100755
--- a/dev-support/pysubmarine/gen-sdk.sh
+++ b/dev-support/pysubmarine/gen-sdk.sh
@@ -29,6 +29,7 @@ submarine_dist_exists=$(find -L "${SUBMARINE_PROJECT_PATH}/submarine-dist/target
 if [[ -z "${submarine_dist_exists}" ]]; then
   cd "${SUBMARINE_PROJECT_PATH}"
   mvn clean package -DskipTests
+  cd "$FWDIR" # go back to FWDIR after packaging
 fi
 
 echo "Generating openAPI 3.0 definition file ..."
diff --git a/dev-support/pysubmarine/gen-sdk.sh b/dev-support/pysubmarine/gen-ts-sdk.sh
similarity index 80%
copy from dev-support/pysubmarine/gen-sdk.sh
copy to dev-support/pysubmarine/gen-ts-sdk.sh
index 4647e76..96c5437 100755
--- a/dev-support/pysubmarine/gen-sdk.sh
+++ b/dev-support/pysubmarine/gen-ts-sdk.sh
@@ -22,13 +22,14 @@ SWAGGER_JAR_URL="https://repo1.maven.org/maven2/org/openapitools/openapi-generat
 SWAGGER_CODEGEN_JAR="openapi-generator-cli.jar"
 SWAGGER_CODEGEN_CONF="swagger_config.json"
 SWAGGER_CODEGEN_FILE="openapi.json"
-SDK_OUTPUT_PATH="sdk/python"
+SDK_OUTPUT_PATH="sdk/typescript-angular"
 
 submarine_dist_exists=$(find -L "${SUBMARINE_PROJECT_PATH}/submarine-dist/target" -name "submarine-dist-*.tar.gz")
 # Build source code if the package doesn't exist.
 if [[ -z "${submarine_dist_exists}" ]]; then
   cd "${SUBMARINE_PROJECT_PATH}"
   mvn clean package -DskipTests
+  cd "$FWDIR" # go back to FWDIR after packaging
 fi
 
 echo "Generating openAPI 3.0 definition file ..."
@@ -45,22 +46,10 @@ if [[ -z "${openapi_generator_cli_exists}" ]]; then
   wget -O "${SWAGGER_CODEGEN_JAR}" "${SWAGGER_JAR_URL}"
 fi
 
-echo "Generating Python SDK for Submarine ..."
+echo "Generating typescript-angular SDK for Submarine ..."
 rm -r sdk/
 java -jar ${SWAGGER_CODEGEN_JAR} generate \
      -i "${SWAGGER_CODEGEN_FILE}" \
-     -g python \
+     -g typescript-angular \
      -o ${SDK_OUTPUT_PATH} \
      -c ${SWAGGER_CODEGEN_CONF}
-
-echo "Insert apache license at the top of file ..."
-for filename in $(find ${SDK_OUTPUT_PATH}/submarine/experiment -type f); do
-  echo "$filename"
-  sed -i -e '1 e cat license-header.txt' "$filename"
-done
-
-echo "Move Experiment API to pysubmarine"
-cp -r sdk/python/submarine/experiment ${SUBMARINE_PROJECT_PATH}/submarine-sdk/pysubmarine/submarine/
-
-echo "Fix Python SDK code style"
-${SUBMARINE_PROJECT_PATH}/submarine-sdk/pysubmarine/github-actions/auto-format.sh
diff --git a/docs/submarine-sdk/pysubmarine/development.md b/docs/submarine-sdk/pysubmarine/development.md
index 20cbb01..c7eaf94 100644
--- a/docs/submarine-sdk/pysubmarine/development.md
+++ b/docs/submarine-sdk/pysubmarine/development.md
@@ -66,7 +66,7 @@ pytest --cov=submarine -vs -m "e2e"
 > Before run this command in local, you should make sure the submarine server is running. 
 
 ### Generate python SDK from swagger
-We use [swagger-codegen](https://swagger.io/docs/open-source-tools/swagger-codegen/)
+We use [open-api generator](https://openapi-generator.tech/docs/installation/#jar)
 to generate pysubmarine client API that used to communicate with submarine server.
 
 If change below files, please run `./dev-support/pysubmarine/gen-sdk.sh`


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org