From 57c0fe706ede7eacf5e097bc9e484d1a050dd5ee Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 2 Jul 2025 22:12:42 +0200 Subject: [PATCH] separate tag for odps routes --- little-hesinde/src/api.rs | 6 ++++-- little-hesinde/src/api/opds/authors.rs | 7 ++++--- little-hesinde/src/api/opds/books.rs | 5 +++-- little-hesinde/src/api/opds/recent.rs | 4 ++-- little-hesinde/src/api/opds/search.rs | 6 +++--- little-hesinde/src/api/opds/series.rs | 7 ++++--- little-hesinde/src/api/static_files.rs | 3 +++ 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/little-hesinde/src/api.rs b/little-hesinde/src/api.rs index 93aec22..286cee0 100644 --- a/little-hesinde/src/api.rs +++ b/little-hesinde/src/api.rs @@ -40,7 +40,8 @@ impl From for calibre_db::data::pagination::SortOrder { } /// OpenAPI tag for all endpoints. -const TAG: &str = "little-hesinde"; +const TAG: &str = "html"; +const OPDS_TAG: &str = "opds"; /// OpenAPI documentation configuration. #[derive(OpenApi)] @@ -51,7 +52,8 @@ const TAG: &str = "little-hesinde"; ) ), tags( - (name = TAG, description = "Browser and OPDS access to a calibre library.") + (name = TAG, description = "Browser access to a calibre library."), + (name = OPDS_TAG, description = "OPDS access to a calibre library.") ) )] struct ApiDoc; diff --git a/little-hesinde/src/api/opds/authors.rs b/little-hesinde/src/api/opds/authors.rs index 825709f..50b37c6 100644 --- a/little-hesinde/src/api/opds/authors.rs +++ b/little-hesinde/src/api/opds/authors.rs @@ -12,9 +12,10 @@ use time::OffsetDateTime; use crate::{ APP_NAME, api::{ - SortOrder, TAG, + SortOrder, authors::{self, SingleAuthorError}, error::{ErrorResponse, HttpStatus}, + OPDS_TAG, }, app_state::AppState, http_error, @@ -48,7 +49,7 @@ http_error!(AuthorsError); #[utoipa::path( get, path = "/authors", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) @@ -107,7 +108,7 @@ http_error!(SingleError); #[utoipa::path( get, path = "/authors/{id}", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) diff --git a/little-hesinde/src/api/opds/books.rs b/little-hesinde/src/api/opds/books.rs index d648f17..0cb0388 100644 --- a/little-hesinde/src/api/opds/books.rs +++ b/little-hesinde/src/api/opds/books.rs @@ -12,8 +12,9 @@ use time::OffsetDateTime; use crate::{ APP_NAME, api::{ - SortOrder, TAG, + SortOrder, error::{ErrorResponse, HttpStatus}, + OPDS_TAG, }, app_state::AppState, data::book::Book, @@ -48,7 +49,7 @@ http_error!(OdpsBooksError); #[utoipa::path( get, path = "/books", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) diff --git a/little-hesinde/src/api/opds/recent.rs b/little-hesinde/src/api/opds/recent.rs index eebdb83..3f0c8e9 100644 --- a/little-hesinde/src/api/opds/recent.rs +++ b/little-hesinde/src/api/opds/recent.rs @@ -11,9 +11,9 @@ use time::OffsetDateTime; use crate::{ APP_NAME, api::{ - TAG, books::{self, RecentBooksError}, error::{ErrorResponse, HttpStatus}, + OPDS_TAG, }, app_state::AppState, http_error, @@ -47,7 +47,7 @@ http_error!(RecentError); #[utoipa::path( get, path = "/recent", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) diff --git a/little-hesinde/src/api/opds/search.rs b/little-hesinde/src/api/opds/search.rs index 3260640..0dde73b 100644 --- a/little-hesinde/src/api/opds/search.rs +++ b/little-hesinde/src/api/opds/search.rs @@ -12,9 +12,9 @@ use super::books::{RenderError, render_books}; use crate::{ APP_NAME, api::{ - TAG, error::{ErrorResponse, HttpStatus}, search::{self, SearchQueryError}, + OPDS_TAG, }, app_state::AppState, http_error, @@ -54,7 +54,7 @@ pub struct Params { #[utoipa::path( get, path = "/search", - tag = TAG, + tag = OPDS_TAG, responses( (status = 200, content_type = "application/atom+xml"), (status = 500, description = "Error retrieving books from database", body = ErrorResponse) @@ -92,7 +92,7 @@ http_error!(InfoError); #[utoipa::path( get, path = "/search/info", - tag = TAG, + tag = OPDS_TAG, responses( (status = 200, content_type = "application/atom+xml"), (status = 500, description = "Internal error", body = ErrorResponse) diff --git a/little-hesinde/src/api/opds/series.rs b/little-hesinde/src/api/opds/series.rs index 48b915b..a96a2bf 100644 --- a/little-hesinde/src/api/opds/series.rs +++ b/little-hesinde/src/api/opds/series.rs @@ -12,9 +12,10 @@ use time::OffsetDateTime; use crate::{ APP_NAME, api::{ - SortOrder, TAG, + SortOrder, error::{ErrorResponse, HttpStatus}, series::{self, SingleSeriesError}, + OPDS_TAG, }, app_state::AppState, http_error, @@ -48,7 +49,7 @@ http_error!(SeriesError); #[utoipa::path( get, path = "/series", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) @@ -107,7 +108,7 @@ http_error!(SingleError); #[utoipa::path( get, path = "/series/{id}", - tag = TAG, + tag = OPDS_TAG, responses( (status = OK, content_type = "application/atom+xml"), (status = 500, description = "Server failure.", body = ErrorResponse) diff --git a/little-hesinde/src/api/static_files.rs b/little-hesinde/src/api/static_files.rs index c6f1ff6..56899c6 100644 --- a/little-hesinde/src/api/static_files.rs +++ b/little-hesinde/src/api/static_files.rs @@ -4,6 +4,8 @@ use axum::{ }; use rust_embed::RustEmbed; +use super::TAG; + /// Embedd static files. #[derive(RustEmbed)] #[folder = "static"] @@ -14,6 +16,7 @@ pub struct Files; #[utoipa::path( get, path = "/static/{*file}", + tag = TAG, responses( (status = 200, description = "Static file"), (status = 404, description = "No such file within 'static'", body = String)