You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
7
7
Breaking changes to any of the following will cause the **minor** version to be incremented (as long as this project is 0.x). Only these pieces are considered part of the public API:
8
8
9
-
1. The _behavior_ of the generated code. Specifically, the way in which generated endpoints and classes are called and the way in which those calls communicate with an OpenAPI server. Any other property of the generated code is not considered part of the versioned, public API (e.g., code formatting, comments).
10
-
2. The invocation of the CLI (e.g., commands or arguments).
9
+
- The _behavior_ of the generated code. Specifically, the way in which generated endpoints and classes are called and the way in which those calls communicate with an OpenAPI server. Any other property of the generated code is not considered part of the versioned, public API (e.g., code formatting, comments).
10
+
- The invocation of the CLI (e.g., commands or arguments).
11
11
12
12
Programmatic usage of this project (e.g., importing it as a Python module) and the usage of custom templates are not considered part of the public API and therefore may change behavior at any time without notice.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,14 @@
21
21
22
22
2. When in a Poetry shell (`poetry shell`) run `task check` in order to run most of the same checks CI runs. This will auto-reformat the code, check type annotations, run unit tests, check code coverage, and lint the code.
23
23
24
-
### Rework end to end tests
24
+
### Rework end-to-end tests
25
25
26
-
3. If you're writing a new feature, try to add it to the end to end test.
26
+
3. If you're writing a new feature, try to add it to the end-to-end test.
27
27
1. If adding support for a new OpenAPI feature, add it somewhere in `end_to_end_tests/openapi.json`
28
-
2. Regenerate the "golden records" with `task regen`. This client is generated from the OpenAPI document used for end to end testing.
28
+
2. Regenerate the "golden records" with `task regen`. This client is generated from the OpenAPI document used for end-to-end testing.
29
29
3. Check the changes to `end_to_end_tests/golden-record` to confirm only what you intended to change did change and that the changes look correct.
30
-
4. Run the end to end tests with `task e2e`. This will generate clients against `end_to_end_tests/openapi.json` and compare them with the golden record. The tests will fail if **anything is different**. The end to end tests are not included in `task check` as they take longer to run and don't provide very useful feedback in the event of failure. If an e2e test does fail, the easiest way to check what's wrong is to run `task regen` and check the diffs. You can also use `task re` which will run `regen` and `e2e` in that order.
30
+
4.**If you added a test above OR modified the templates**: Run the end-to-end tests with `task e2e`. This will generate clients against `end_to_end_tests/openapi.json` and compare them with the golden record. The tests will fail if **anything is different**. The end-to-end tests are not included in `task check` as they take longer to run and don't provide very useful feedback in the event of failure. If an e2e test does fail, the easiest way to check what's wrong is to run `task regen` and check the diffs. You can also use `task re` which will run `regen` and `e2e` in that order.
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
45
+
46
+
```python
47
+
client = AuthenticatedClient(
48
+
base_url="https://internal_api.example.com",
49
+
token="SuperSecretToken",
50
+
verify_ssl="/path/to/certificate_bundle.pem",
51
+
)
52
+
```
53
+
54
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
55
+
56
+
```python
57
+
client = AuthenticatedClient(
58
+
base_url="https://internal_api.example.com",
59
+
token="SuperSecretToken",
60
+
verify_ssl=False
61
+
)
62
+
```
63
+
64
+
Things to know:
65
+
1. Every path/method combo becomes a Python module with four functions:
66
+
1.`sync`: Blocking request that returns parsed data (if successful) or `None`
67
+
1.`sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
68
+
1.`asyncio`: Like `sync` but the async instead of blocking
69
+
1.`asyncio_detailed`: Like `sync_detailed` by async instead of blocking
70
+
71
+
1. All path/query params, and bodies become method arguments.
72
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
73
+
1. Any endpoint which did not have a tag will be in `open_api_test_server_client.api.default`
74
+
75
+
## Building / publishing this Client
76
+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
77
+
1. Update the metadata in pyproject.toml (e.g. authors, version)
78
+
1. If you're using a private repository, configure it with Poetry
0 commit comments