Skip to content

Getting started

Install the CLI from crates.io:

Terminal window
cargo install orator

Point Orator at your OpenAPI 3.1 spec:

Terminal window
orator --output src/generated spec.yaml

This produces a set of Rust modules containing your request/response types, operation traits, and (if using axum) a ready-made router.

Orator generates a trait per tag in your spec. You bring your own struct and implement the trait on it — that’s where your actual logic lives.

struct MyApi;
impl PetsApi for MyApi {
type Error = MyError;
async fn list_pets(
&self,
_ctx: Context,
params: ListPetsParams,
) -> Result<ListPetsResponse, Self::Error> {
// your logic here
Ok(ListPetsResponse::Ok(vec![]))
}
}

Have a look at the tennis club example for a more complete walkthrough.