-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·45 lines (31 loc) · 1.14 KB
/
install.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
#!/bin/bash
# Read .env
source .env
# Install openapi-generator-cli globally
npm install -g @openapitools/openapi-generator-cli
# Create and navigate to the generator-output directory
mkdir generator-output && cd generator-output || exit
# Set openapi-generator-cli version to 5.4.0
openapi-generator-cli version-manager set 5.4.0
# Generate Python client using the specified OpenAPI URL
openapi-generator-cli generate -g python -i $PLANQK_OPEN_API_SPEC_URL
# Copy the generated client to the parent directory
cp -R openapi_client ../src
# Navigate back to the parent directory
cd ..
# Remove the generator-output directory
rm -rf generator-output
# Replace faulty openapi generation
echo ""
echo "Replace faulty openapi generation"
# Specify the file path
file_path=("src/openapi_client/api/service_platform___services_api.py")
search_list=("(UNKNOWN_BASE_TYPE,)," "'unknown_base_type':" "from openapi_client.model.unknownbasetype import UNKNOWNBASETYPE")
for search in "${search_list[@]}"; do
replace="# ${search}"
echo $search
echo $replace
# Find and replace the line
sed -i "s/${search}/${replace}/" "$file_path"
echo ""
done