From ea15dbb5559fef62baf608cc6149d1a0f0370e72 Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:56:22 +0100 Subject: [PATCH] Refactor OpenAPI fetcher for improved clarity and robustness Reorganized and enhanced the OpenAPI fetch logic for better maintainability and error handling. Key updates include improved environment variable validation, more detailed error messages, streamlined configuration loading, and additional safety checks for file paths and directories. Added proper logging and ensured the process flow is easy to trace. --- backend/main.py | 3 +++ make_openapi_client.sh | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index 8204356..903b536 100644 --- a/backend/main.py +++ b/backend/main.py @@ -42,6 +42,9 @@ app = FastAPI( title=project_name, description="Backend for next-gen sample management system", version=project_version, + servers=[ + {"url": "https://mx-aare-test.psi.ch:1492", "description": "Default server"} + ], ) # Determine environment and configuration file path diff --git a/make_openapi_client.sh b/make_openapi_client.sh index 44503b8..e56c706 100755 --- a/make_openapi_client.sh +++ b/make_openapi_client.sh @@ -36,7 +36,7 @@ java -jar openapi-generator-cli.jar generate \ -i openapi.json \ -o python-client/ \ -g python \ - --additional-properties=packageName="${NAME}_client",projectName="${NAME}",packageVersion="${VERSION}" + --additional-properties=packageName="${NAME}client",projectName="${NAME}",packageVersion="${VERSION}" if [[ ! -d python-client ]]; then echo "Error: Failed to generate Python client." diff --git a/pyproject.toml b/pyproject.toml index bbfbfe0..c043e5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "aareDB" -version = "0.1.0a4" +version = "0.1.0a5" description = "Backend for next gen sample management system" authors = [{name = "Guillaume Gotthard", email = "guillaume.gotthard@psi.ch"}] license = {text = "MIT"}