forked from annawolfe1/JuliaOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-python-client.sh
More file actions
executable file
·38 lines (30 loc) · 1.32 KB
/
generate-python-client.sh
File metadata and controls
executable file
·38 lines (30 loc) · 1.32 KB
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
# To run this script, you will need:
# - Java 11+
# - openapi-generator-cli.jar, which can be downloaded from https://openapi-generator.tech/docs/installation/#jar
JARNAME="openapi-generator-cli.jar"
PKGNAME="_juliaos_client_api"
if [ ! -f "$JARNAME" ]; then
echo "Missing $JARNAME. Please download it from https://openapi-generator.tech/docs/installation/#jar"
exit 1
fi
if [ -e ./python/src/temp ]; then
echo "The file ./python/src/temp already exists. Please remove it before running this script."
exit 1
fi
if [ -e ./temp-generated ]; then
echo "The file ./temp-generated already exists. Please remove it before running this script."
exit 1
fi
java -jar $JARNAME generate \
-i ./backend/src/api/spec/api-spec.yaml \
-g python-pydantic-v1 \
-o ./python/src/$PKGNAME/ \
--additional-properties=packageName=$PKGNAME \
--additional-properties=exportModels=true
# Only the Python source code is needed directly in python/src/.
# We move the rest to ./temp-generated in case some of the generated files, e.g. documentation, are needed in development.
# Otherwise, ./temp-generated can be safely deleted.
mv ./python/src/$PKGNAME/$PKGNAME ./python/src/temp
mv ./python/src/$PKGNAME ./temp-generated
mv ./python/src/temp ./python/src/$PKGNAME
echo "The directory ./temp-generated can be safely deleted."