Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That must refer to the this call

    session.run(
        "openapi-python-client",
        "update",
        "--url", f"{SAAS_HOST}/openapi.json",
        "--config", "openapi_config.yml",
        silent=silent,
    )

in the generate_api function. Should we be specific?

* 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"... a non-existing top-level directory as name ..." That refers to the project_name_override: "generate" in the yaml below. Could you make this more explicit?


```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