Skip to main content

Module openapi

Module openapi 

Source
Expand description

OpenAPI specification builder and documentation handlers.

Generates OpenAPI specs from Ferro route metadata and serves interactive API documentation via ReDoc.

§Example

use ferro_rs::{build_openapi_spec, OpenApiConfig, get_registered_routes};

// Build spec from registered routes
let config = OpenApiConfig {
    title: "My API".to_string(),
    version: "1.0.0".to_string(),
    description: Some("My application API".to_string()),
    api_prefix: "/api/".to_string(),
};
let spec = build_openapi_spec(&config, &get_registered_routes());

// Serve JSON spec
let json = openapi_json_response(&config, &get_registered_routes());

// Serve ReDoc HTML
let html = openapi_docs_response(&config, &get_registered_routes());

Structs§

OpenApiConfig
Configuration for OpenAPI spec generation.

Functions§

build_openapi_spec
Build an OpenAPI spec from route metadata.
openapi_docs_response
Return an HttpResponse with ReDoc HTML documentation.
openapi_json_response
Return an HttpResponse with the OpenAPI spec as JSON.