forked from pulp/pulp-openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·44 lines (40 loc) · 1.21 KB
/
generate.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
if [ $# -eq 0 ]; then
echo "No arguments provided"
exit 1
fi
# Download the schema
curl -o api.json http://localhost:24817/pulp/api/v3/docs/api.json?plugin=$1
# Get the version of the pulpcore or plugin as reported by status API
if [ ${3-x} ];
then
export VERSION=$3
else
export VERSION=$(http :24817/pulp/api/v3/status/ | jq --arg plugin $1 -r '.versions[] | select(.component == $plugin) | .version')
fi
if [ $2 = 'python' ]
then
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/api.json \
-g python \
-o /local/$1-client \
-DpackageName=pulpcore.client.$1 \
-DprojectName=$1-client \
-DpackageVersion=${VERSION} \
--skip-validate-spec \
--strict-spec=false
cp python/__init__.py $1-client/pulpcore/
cp python/__init__.py $1-client/pulpcore/client
fi
if [ $2 = 'ruby' ]
then
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/api.json \
-g ruby \
-o /local/$1-client \
-DgemName=$1_client \
-DgemLicense="GPLv2" \
-DgemVersion=${VERSION} \
--skip-validate-spec \
--strict-spec=false
fi
rm api.json