Utoipa polish

This commit is contained in:
Antoine Gersant 2025-01-15 22:47:15 -08:00
parent 4625bf221d
commit 8ccc9cc2ee
2 changed files with 5 additions and 4 deletions
src/server

View file

@ -1024,7 +1024,7 @@ async fn get_playlists(
("auth_token" = []), ("auth_token" = []),
("auth_query_param" = []), ("auth_query_param" = []),
), ),
params(("name",)), params(("name", example = "Chill Jazz")),
request_body = dto::SavePlaylistInput, request_body = dto::SavePlaylistInput,
)] )]
async fn put_playlist( async fn put_playlist(
@ -1057,7 +1057,7 @@ async fn put_playlist(
), ),
params( params(
("Accept-Version" = Option<i32>, Header, minimum = 7, maximum = 8), ("Accept-Version" = Option<i32>, Header, minimum = 7, maximum = 8),
("name",), ("name", example = "Chill Jazz"),
), ),
responses( responses(
(status = 200, body = dto::Playlist), (status = 200, body = dto::Playlist),
@ -1097,7 +1097,7 @@ async fn get_playlist(
("auth_token" = []), ("auth_token" = []),
("auth_query_param" = []), ("auth_query_param" = []),
), ),
params(("name",)), params(("name", example = "Chill Jazz")),
)] )]
async fn delete_playlist( async fn delete_playlist(
auth: Auth, auth: Auth,

View file

@ -48,7 +48,6 @@ pub struct AuthQueryParameters {
#[derive(Serialize, Deserialize, IntoParams, ToSchema)] #[derive(Serialize, Deserialize, IntoParams, ToSchema)]
pub struct ThumbnailOptions { pub struct ThumbnailOptions {
#[schema(examples("tiny", "small", "large", "native"))]
pub size: Option<ThumbnailSize>, pub size: Option<ThumbnailSize>,
#[schema(examples(true, false))] #[schema(examples(true, false))]
pub pad: Option<bool>, pub pad: Option<bool>,
@ -65,6 +64,7 @@ impl From<ThumbnailOptions> for thumbnail::Options {
#[derive(Clone, Copy, Serialize, Deserialize, ToSchema)] #[derive(Clone, Copy, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
#[schema(example = "small")]
pub enum ThumbnailSize { pub enum ThumbnailSize {
Tiny, Tiny,
Small, Small,
@ -321,6 +321,7 @@ impl From<index::Song> for Song {
pub struct SongList { pub struct SongList {
#[schema(value_type = Vec<String>, examples(json!(["my_music/destiny.mp3", "my_music/sos.mp3"])))] #[schema(value_type = Vec<String>, examples(json!(["my_music/destiny.mp3", "my_music/sos.mp3"])))]
pub paths: Vec<PathBuf>, pub paths: Vec<PathBuf>,
/// Detailed metadata about the first few hundred songs listed in `.paths`
pub first_songs: Vec<Song>, pub first_songs: Vec<Song>,
} }