Client
openapi_first.client
OpenAPI-first HTTP client for contract-driven services.
Summary
This module provides OpenAPIClient, a thin, strict HTTP client that
derives all callable operations directly from an OpenAPI 3.x specification.
It is the client counterpart to OpenAPIFirstApp.
Notes
Core Principles:
1 2 3 4 5 | |
Responsibilities:
1 2 3 4 5 6 | |
Constraints:
1 | |
Classes
OpenAPIClient
OpenAPI-first HTTP client (httpx-based).
Notes
Responsibilities:
1 | |
Guarantees:
1 2 3 4 5 | |
Example
Initialize the OpenAPI client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec |
dict[str, Any]
|
Parsed OpenAPI 3.x specification. |
required |
base_url |
str
|
Base URL of the target service. If omitted, the first entry in the OpenAPI |
None
|
client |
Client
|
Optional preconfigured httpx client instance. |
None
|
Raises:
| Type | Description |
|---|---|
OpenAPIClientError
|
If no servers are defined, spec has no paths, operationIds are missing/duplicate, or required parameters are missing. |
Functions
OpenAPIClientError
Bases: OpenAPIFirstError
Raised when an OpenAPI client operation fails.