Releases: MrLoh/openapi-httpx
Releases · MrLoh/openapi-httpx
v0.1.2
Changes
- Support
datamodel-code-generator0.55+ — upstream removed thedatamodel_code_generator.model.pydanticsubmodule and renamedCustomRootTypetoRootModelin 0.55. We now import frompydantic_v2with a fallback, so the package works across>=0.35.0,<1.0. Dependency range widened accordingly.
Full Changelog: v0.1.1...v0.1.2
v0.1.1
Changes
- Documentation site — added a MkDocs-based docs site published via GitHub Pages, with usage, client reference, and API reference pages. Includes a
poetry docstask for local preview. - Explicit public API — added
__all__ = ["Config", "PythonVersion", "generate"]toopenapi_httpx/__init__.pyso the public surface is unambiguous to type checkers and re-exporters.
Full Changelog: v0.1.0...v0.1.1
v0.1.0
First release. openapi-httpx generates a typed httpx.Client (or AsyncClient) subclass from an OpenAPI 3.x spec. Path, query params, request body, and response type are all checked as a single unit per operation — no separate request/response model classes to keep in sync.
pip install openapi-httpx
openapi-httpx --input openapi.yaml --output client.pyWhy this shape
The generated client is an httpx.Client subclass with one @overload per operation, keyed on the path literal:
client.GET("/user/{id}", params={"id": "123"}) # -> User
client.POST("/user", json={"name": "Ada"}) # -> UserYou keep the full httpx.Client API (timeouts, event hooks, transports, auth) and gain per-endpoint types. No wrapper object, no new API to learn beyond httpx itself.
What's in 0.1.0
- Sync and async clients (
--async-client) TypedDicts for params, bodies, and responses- Multipart form data with automatic file/field splitting
- Optional closed
TypedDicts (PEP 728) via--use-closed-typed-dict - Python 3.11 – 3.14
Caveats worth knowing
- Path parameters go in
params, not f-strings — interpolating into the path breaks overload resolution - Responses are returned already parsed (
jsonby default, ortext/Nonefor raw bytes), andraise_for_status()is called automatically - Built on datamodel-code-generator, currently pinned
<0.54