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§
- Open
ApiConfig - 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.