From 2bbb8a1617b0bcfe578a86aef5a20e4bbf0bd916 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Tue, 19 Aug 2025 13:09:53 -0400 Subject: [PATCH] tsk-170: Adding code to document API --- src/callers/song.rs | 3 +++ src/main.rs | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/callers/song.rs b/src/callers/song.rs index 2bfc552..c853eb0 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -856,6 +856,9 @@ mod song_queue { pub mod endpoint { use axum::{Json, http::StatusCode, response::IntoResponse}; + use utoipa::OpenApi; + use utoipa_swagger_ui::SwaggerUi; + use std::io::Write; use crate::callers::song::song_queue; diff --git a/src/main.rs b/src/main.rs index f016dbf..dbdd9d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ pub mod auth; pub mod callers; + pub mod db { use sqlx::postgres::PgPoolOptions; @@ -29,6 +30,16 @@ pub mod db { } } +#[derive(utoipa::OpenApi)] +#[openapi( + paths(crate::callers::song::endpoint::queue_song), + components(schemas(crate::callers::song::response::Response)), + tags( + (name = "queue song", description = "Start process to upload song by queueing the song") + ) +)] +struct ApiDoc; + #[tokio::main] async fn main() { // initialize tracing