Skip to content

Commit

Permalink
Bug/#25 fix transitive dependencies required by generated api client (#…
Browse files Browse the repository at this point in the history
…26)

Co-authored-by: Christoph Pirkl <[email protected]>
  • Loading branch information
ckunki and kaklakariada authored Apr 30, 2024
1 parent 372c512 commit 9ba088e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/changes/changes_0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 9ba088e

Please sign in to comment.