#[client]Expand description
Generates transport-agnostic Rust client traits from an OpenAPI specification file.
Apply this attribute to a mod block. The macro reads the OpenAPI
document at the given path (resolved relative to CARGO_MANIFEST_DIR) at
compile time and replaces the module’s contents with:
- Schema structs derived from
components/schemas - A
{OperationId}Requeststruct per operation (bundles path, query, header params and the request body) - Per-operation
{OperationId}Responseenums whose variants map to HTTP status codes - A
{ModName}Clienttrait with one method per operation (keyed byoperationId) - When the
reqwest-clientcargo feature is enabled throughopenapi-trait, a blanket reqwest-backed implementation for any user type derivingReqwestClient
The generated trait name is derived from the annotated module name, so
mod petstore {} produces petstore::PetstoreClient.