Crate rovo

Crate rovo 

Source
Expand description

§Rovo

A lightweight macro-based framework for generating OpenAPI documentation from doc comments in Axum handlers.

Rovo provides a declarative way to document your API endpoints using special annotations in doc comments, automatically generating OpenAPI specifications without manual schema definitions.

§Quick Start

use rovo::{Router, rovo, routing::get, schemars::JsonSchema, aide::axum::IntoApiResponse};
use rovo::aide::openapi::OpenApi;
use axum::{extract::Path, response::Json};
use serde::Serialize;

#[derive(Serialize, JsonSchema)]
struct User { id: u32, name: String }

/// Get user by ID
///
/// @response 200 Json<User> User found successfully
/// @response 404 () User not found
/// @tag users
#[rovo]
async fn get_user(Path(id): Path<u32>) -> impl IntoApiResponse {
    Json(User { id, name: "Alice".to_string() })
}

let mut api = OpenApi::default();
api.info.title = "My API".to_string();

let app = Router::new()
    .route("/users/{id}", get(get_user))
    .with_oas(api)
    .with_swagger("/swagger");

§Supported Annotations

  • @response <code> <type> <description> - Document response types
  • @example <code> <expression> - Provide response examples
  • @tag <name> - Group endpoints by tags
  • @security <scheme> - Specify security requirements
  • @id <operation_id> - Set custom operation ID
  • @hidden - Hide endpoint from documentation
  • @rovo-ignore - Stop processing annotations after this point

Re-exports§

pub use aide;
pub use schemars;

Modules§

axum
Re-exports from aide’s axum integration for convenience.
routing
Drop-in replacement routing functions that work with #[rovo] decorated handlers.

Structs§

ApiMethodRouter
Wrapper around ApiMethodRouter that provides method chaining for documented handlers.
Router
A drop-in replacement for axum::Router that adds OpenAPI documentation support.

Traits§

IntoApiMethodRouter
Trait for handlers that carry their own documentation.

Attribute Macros§

rovo
Macro that generates OpenAPI documentation from doc comments.