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: README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,8 @@ Generate a client from an OpenAPI spec in `openapi.json`:
24
24
# Types + HTTP transport
25
25
uv run openapi-python generate --spec ./openapi.json --out ./generated
26
26
27
-
# Types
28
-
uv run openapi-python generate --spec ./openapi.json --out ./generated --transport-mode protocol-only
27
+
# Types + custom transport protocol
28
+
uv run openapi-python generate --spec ./openapi.json --out ./generated --protocol-only
29
29
```
30
30
31
31
... or programatically:
@@ -87,7 +87,9 @@ book = client.get("/books/{book_id}")(params={"book_id": 1})
87
87
88
88
Generated clients expose a transport protocol. You can plug in your own transport while keeping route-level typing guarantees.
89
89
90
-
Use `--transport-mode protocol-only` to generate clients that require a supplied transport and do not emit the built-in `httpx` transport classes. The default `--transport-mode default` includes `DefaultTransport` and `DefaultAsyncTransport`, which require the `httpx` extra when instantiated.
90
+
Use `--protocol-only` to generate clients that require a supplied transport and do not emit the built-in `httpx` transport classes. By default, generated clients include `DefaultTransport` and `DefaultAsyncTransport`, which require the `httpx` extra when instantiated.
91
+
92
+
Protocol typing can be relaxed independently with `--no-routes`, `--no-requests`, and `--no-responses`. Those flags replace the corresponding route literals, request payload types, or response types with broad catch-all types.
91
93
92
94
### Built-in `httpx` transport
93
95
@@ -128,7 +130,7 @@ uv run openapi-python generate \
128
130
--spec ./openapi.json \
129
131
--out ./generated \
130
132
--package my_client \
131
-
--transport-mode protocol-only
133
+
--protocol-only
132
134
```
133
135
134
136
Then provide an object that satisfies the generated `Transport` protocol:
0 commit comments