feat(presentation): OpenAPI docs at /docs (Swagger) and /scalar

This commit is contained in:
2026-05-14 11:41:12 +02:00
parent 137d1a0c6a
commit 1866eef770
11 changed files with 164 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ use activitypub_base::{
ApFederationConfig,
};
use activitypub_federation::config::FederationMiddleware;
use crate::{handlers::*, state::AppState};
use crate::{handlers::*, openapi, state::AppState};
pub fn router(fed_config: &ApFederationConfig) -> Router<AppState> {
let api_routes = Router::new()
@@ -79,8 +79,10 @@ pub fn router(fed_config: &ApFederationConfig) -> Router<AppState> {
.route("/users/{username}/followers", get(followers_handler))
.route("/users/{username}/following", get(following_handler));
Router::new()
let combined = Router::new()
.merge(api_routes)
.merge(ap_routes)
.layer(FederationMiddleware::new(fed_config.0.clone()))
.layer(FederationMiddleware::new(fed_config.0.clone()));
openapi::serve(combined)
}