-
Notifications
You must be signed in to change notification settings - Fork 42
/
gen_apis.sh
executable file
·28 lines (21 loc) · 1.19 KB
/
gen_apis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
(
#download swagger-codegen-cli if not already there.
cd "$PWD"
mkdir -p $PWD/swagger
if [ ! -f $PWD/swagger/swagger-codegen-cli.jar ]; then
echo "swagger cli not found, downloading..."
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.27/swagger-codegen-cli-2.4.27.jar -O ./swagger/swagger-codegen-cli.jar
fi
#Generate API docs
executable="$PWD/swagger/swagger-codegen-cli.jar"
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
agsDocs="$@ generate -i $PWD/swagger/chainquery.yaml -l dynamic-html -o $PWD"
agsServer="$@ generate -i $PWD/swagger/chainquery.yaml -l go-server -t $PWD/swagger/modules/go-server -Dmodel={} -o $PWD/swagger/apiserver"
agsClient_go="$@ generate -i $PWD/swagger/chainquery.yaml -l go -o $PWD/swagger/clients/goclient"
agsClient_python="$@ generate -i $PWD/swagger/chainquery.yaml -l python -o $PWD/swagger/clients/pythonclient"
java $JAVA_OPTS -jar $executable $agsDocs
java $JAVA_OPTS -jar $executable $agsServer
java $JAVA_OPTS -jar $executable $agsClient_go
java $JAVA_OPTS -jar $executable $agsClient_python
)