armature-openapi

Crates.ioarmature-openapi
lib.rsarmature-openapi
version0.1.1
created_at2025-12-26 23:50:55.538829+00
updated_at2025-12-29 01:19:21.75344+00
descriptionOpenAPI specification generation for Armature APIs
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006450
size111,212
Joseph R. Quinn (quinnjr)

documentation

README

armature-openapi

OpenAPI/Swagger documentation for the Armature framework.

Features

  • Auto Generation - Generate OpenAPI spec from routes
  • Swagger UI - Built-in documentation UI
  • Type Inference - Infer types from handlers
  • Validation - Validate requests against schema
  • Export - JSON/YAML spec export

Installation

[dependencies]
armature-openapi = "0.1"

Quick Start

use armature_openapi::{OpenApi, swagger_ui};
use armature_core::Application;

#[derive(OpenApi)]
struct ApiDoc;

let app = Application::new()
    .get("/users", list_users)
    .post("/users", create_user)
    .get("/swagger-ui/*", swagger_ui(ApiDoc::openapi()))
    .get("/openapi.json", openapi_spec(ApiDoc::openapi()));

Annotations

/// List all users
#[openapi(
    summary = "List users",
    responses(
        (status = 200, description = "List of users", body = Vec<User>)
    )
)]
async fn list_users() -> Json<Vec<User>> {
    // ...
}

Request Body

#[derive(ToSchema)]
struct CreateUser {
    /// User's name
    name: String,
    /// User's email
    email: String,
}

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt