From 9ba088e5c6da4228ef2a2798c0aeeff76fe40891 Mon Sep 17 00:00:00 2001 From: Christoph Kuhnke Date: Tue, 30 Apr 2024 15:06:08 +0200 Subject: [PATCH] Bug/#25 fix transitive dependencies required by generated api client (#26) Co-authored-by: Christoph Pirkl <4711730+kaklakariada@users.noreply.github.com> --- doc/changes/changes_0.3.0.md | 1 + doc/developer_guide/developer_guide.md | 20 ++++++++++++++++++++ pyproject.toml | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/doc/changes/changes_0.3.0.md b/doc/changes/changes_0.3.0.md index 810d185..d323609 100644 --- a/doc/changes/changes_0.3.0.md +++ b/doc/changes/changes_0.3.0.md @@ -8,3 +8,4 @@ This release adds integration tests for the most important calls to SaaS API. * #21: Added integration test for operation "create database" * #23: Added integration test for operation "add IP to whitelist" +* #25: Fixed transitive dependencies required by generated API client diff --git a/doc/developer_guide/developer_guide.md b/doc/developer_guide/developer_guide.md index 4c5a7a8..2e29c4f 100644 --- a/doc/developer_guide/developer_guide.md +++ b/doc/developer_guide/developer_guide.md @@ -36,6 +36,26 @@ Use CLI option `--path` to read the JSON definition from a local file instead of "--path", "/path/to/openapi.json", ``` +### Generate file `pyproject.toml` + +openapi-python-client reads the JSON specification of the SaaS API and generates a python client. The generated client code requires transitive dependencies, though, which need to be added to file `pyproject.toml` to make them available for dependents of SAPIPY. + +The easiest way is to make openapi-python-client create a dedicated file `pyproject.toml` and copy the transitive dependencies from there to SAPIPY's file `pyproject.toml`. + +In order to create file `pyproject.toml` +* In file `noxfile.py` you need to replace mode `update` by `generate` +* Additionally in file `openapi_config.yml` you need to specify a non-existing top-level directory as `name` and a package that does not contain slashes, e.g. + +```yaml +project_name_override: "generate" +package_name_override: saas.client.openapi +post_hooks: [] +``` + +After generating the API, +* Copy the dependencies from file `generate/pyproject.toml` and +* Remove directory `generate`. + ## Run Tests Executing the integration tests requires the following environment variables to be set: diff --git a/pyproject.toml b/pyproject.toml index 3fe57fa..b17b8af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,10 @@ python = ">=3.8.0,<4.0" requests = "^2.31.0" types-requests = "^2.31.0.6" ifaddr = "^0.2.0" +# generated by openapi-python-client +httpx = ">=0.20.0,<0.28.0" +attrs = ">=21.3.0" +python-dateutil = "^2.8.0" [build-system]