rustapi-openapi

Crates.iorustapi-openapi
lib.rsrustapi-openapi
version0.1.207
created_at2025-12-30 14:49:59.356105+00
updated_at2026-01-26 00:02:11.336988+00
descriptionAutomated OpenAPI 3.0 specification generator for RustAPI. Integrates Swagger UI.
homepagehttps://github.com/Tuntii/RustAPI
repositoryhttps://github.com/Tuntii/RustAPI
max_upload_size
id2012758
size1,950,978
Tunay (Tuntii)

documentation

https://docs.rs/rustapi-openapi

README

RustAPI OpenAPI

Automated API specifications and Swagger UI integration.

ℹ️ Note: This crate is used internally by rustapi-rs to provide the .docs() method on the server builder.

How It Works

  1. Reflection: RustAPI macros collect metadata about your routes (path, method, input types, output types) at compile time.
  2. Schema Gen: It uses utoipa to generate JSON Schemas for your Rust structs.
  3. Spec Build: At runtime, it assembles the full OpenAPI 3.0 JSON specification.
  4. UI Serve: It embeds the Swagger UI assets and serves them at your specified path.

Customization

You can inject custom security schemes or info into the spec via the RustApi builder.

RustApi::new()
    .api_name("My Enterprise API")
    .api_version("2.1.0")
    .docs("/swagger-ui")
    .run("0.0.0.0:3000")
    .await
Commit count: 208

cargo fmt