Skip to content

Commit

Permalink
Integrated automatically generated Dataland API clients.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcTM01 committed Oct 14, 2024
1 parent a54e527 commit 7c206c7
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
*.iml
*.iml

# Automatically generated API clients
clients/
39 changes: 39 additions & 0 deletions bin/generate_dataland_api_clients.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
. bin/utils.sh

assert_called_from_project_root

set -euxo pipefail
mkdir -p "./clients"

function openapi_generator() {
if [ ! -f "./clients/openapi-generator-cli.jar" ]; then
echo "OpenAPI Generator not found. Downloading..."
curl https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -o ./clients/openapi-generator-cli.jar
fi
java -jar ./clients/openapi-generator-cli.jar "$@"
}

# Dataland Backend
rm -rf ./clients/backend
openapi_generator generate \
-i https://dataland.com/api/v3/api-docs/public \
-g python \
--additional-properties=packageName=dataland_backend \
-o './clients/backend'

# Dataland Document Manager
rm -rf ./clients/documents
openapi_generator generate \
-i https://dataland.com/documents/v3/api-docs/public \
-g python \
--additional-properties=packageName=dataland_documents \
-o './clients/documents'

# Dataland QA Service
rm -rf ./clients/qa
openapi_generator generate \
-i https://dataland.com/qa/v3/api-docs/public \
-g python \
--additional-properties=packageName=dataland_qa \
-o './clients/qa'
13 changes: 13 additions & 0 deletions bin/setup_dev_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
. bin/utils.sh

assert_called_from_project_root

set -euxo pipefail
mkdir -p "./clients"

# Generate clients
./bin/generate_dataland_api_clients.sh

# Setup PDM
pdm install
6 changes: 6 additions & 0 deletions bin/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function assert_called_from_project_root() {
if ! [ -d .git ]; then
echo "Please ensure that you call this script from the root of the python project (i.e., using ./bin/generate_dataland_api_clients.sh)"
exit 1
fi
}
159 changes: 158 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name = "dataland-qa-lab"
version = "0.1.0"
description = "The Dataland Quality Assurance Lab is a joint project between a team of students from TU Darmstadt, Dataland, and d-fine building automated quality assurance solutions for the Dataland platform in the winter term 2024/2025."
authors = []
dependencies = []
dependencies = [
"dataland-backend @ file:///${PROJECT_ROOT}/clients/backend",
"dataland-documents @ file:///${PROJECT_ROOT}/clients/documents",
"dataland-qa @ file:///${PROJECT_ROOT}/clients/qa",
]
requires-python = ">=3.12"
readme = "README.md"
license = {text = "AGPL-3.0-only"}
Expand Down

0 comments on commit 7c206c7

Please sign in to comment.