-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_in_docker.sh
executable file
·65 lines (56 loc) · 1.37 KB
/
generate_in_docker.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env sh
OPENAPI_GENERATOR_NAME=go
OPENAPI_GENERATOR_LANG=go
usage()
{
echo "Usage : $0 [options]
Options:
-h Display this message
-g Generator name (go/js)"
}
while getopts ":g:h" opt
do
case $opt in
h)
usage
exit 0
;;
g)
OPENAPI_GENERATOR_LANG="${OPTARG}"
;;
*)
echo "option does not exist: ${OPTARG}"
usage
exit 1
;;
esac
done
shift $(($OPTIND-1))
case "$OPENAPI_GENERATOR_LANG" in
go)
OPENAPI_GENERATOR_NAME=go
export GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w"
OPENAPI_GENERATOR_REPO_ID=goqedit
;;
js)
OPENAPI_GENERATOR_NAME=javascript
OPENAPI_GENERATOR_REPO_ID=jsqedit
;;
python)
OPENAPI_GENERATOR_NAME=python
OPENAPI_GENERATOR_REPO_ID=pyqedit
;;
*)
echo "unknown generator language: ${OPENAPI_GENERATOR_LANG}"
exit 1
esac
echo "NOTE: assuming that this file is running on the docker image openapitools/openapi-generator-cli"
script_path=$(readlink -f $(dirname $0))
echo "running in ${script_path}"
/usr/local/bin/docker-entrypoint.sh generate \
--input-spec "/${script_path}/spec/asset-swagger.yaml" \
--generator-name "$OPENAPI_GENERATOR_NAME" \
--output "/${script_path}/${OPENAPI_GENERATOR_LANG}" \
--git-user-id "QED-it" \
--git-repo-id "$OPENAPI_GENERATOR_REPO_ID" \
--config "/${script_path}/${OPENAPI_GENERATOR_LANG}.json"