update utoipa and swagger doc gen (#1171)

This commit is contained in:
Brandon Thomas authored and GitHub committed 2026-03-18 22:49:04 -04:00
1 parent fea20c417c
commit 1178bb7ebf
35 files changed
+91 -55

No files matched your search

Generated
+45 -29
View File
@@ -619,9 +619,9 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "arbitrary"
version = "1.3.2"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
dependencies = [
"derive_arbitrary",
]
@@ -3077,9 +3077,9 @@ dependencies = [
[[package]]
name = "derive_arbitrary"
version = "1.3.2"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
dependencies = [
"proc-macro2",
"quote",
@@ -4170,6 +4170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
dependencies = [
"crc32fast",
"libz-rs-sys",
"miniz_oxide",
]
@@ -5288,6 +5289,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"utoipa",
"workspace-build-acceleration",
]
@@ -6442,6 +6444,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "libz-rs-sys"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415"
dependencies = [
"zlib-rs",
]
[[package]]
name = "libz-sys"
version = "1.1.22"
@@ -9322,6 +9333,7 @@ dependencies = [
"serde",
"tokens",
"url",
"utoipa",
"workspace-build-acceleration",
]
@@ -13320,9 +13332,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "utoipa"
version = "4.1.0"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ff05e3bac2c9428f57ade702667753ca3f5cf085e2011fe697de5bfd49aa72d"
checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
dependencies = [
"indexmap 2.13.0",
"serde",
@@ -13332,33 +13344,33 @@ dependencies = [
[[package]]
name = "utoipa-gen"
version = "4.1.0"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0b6f4667edd64be0e820d6631a60433a269710b6ee89ac39525b872b76d61d"
checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"regex",
"syn 2.0.117",
"url",
]
[[package]]
name = "utoipa-swagger-ui"
version = "7.1.0"
version = "9.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943e0ff606c6d57d410fd5663a4d7c074ab2c5f14ab903b9514565e59fa1189e"
checksum = "d047458f1b5b65237c2f6dc6db136945667f40a7668627b3490b9513a3d43a55"
dependencies = [
"actix-web",
"base64 0.22.1",
"mime_guess",
"regex",
"reqwest 0.12.23",
"rust-embed",
"serde",
"serde_json",
"url",
"utoipa",
"zip 1.1.4",
"zip 3.0.0",
]
[[package]]
@@ -15268,22 +15280,6 @@ dependencies = [
"zstd 0.11.2+zstd.1.5.2",
]
[[package]]
name = "zip"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cc23c04387f4da0374be4533ad1208cbb091d5c11d070dfef13676ad6497164"
dependencies = [
"arbitrary",
"crc32fast",
"crossbeam-utils",
"displaydoc",
"flate2",
"indexmap 2.13.0",
"num_enum 0.7.2",
"thiserror 1.0.63",
]
[[package]]
name = "zip"
version = "2.1.3"
@@ -15313,6 +15309,20 @@ dependencies = [
"zstd 0.13.3",
]
[[package]]
name = "zip"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308"
dependencies = [
"arbitrary",
"crc32fast",
"flate2",
"indexmap 2.13.0",
"memchr",
"zopfli",
]
[[package]]
name = "zip_archives"
version = "0.0.1"
@@ -15322,6 +15332,12 @@ dependencies = [
"zip 0.6.6",
]
[[package]]
name = "zlib-rs"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3"
[[package]]
name = "zmij"
version = "1.0.21"
+1 -1
View File
@@ -333,7 +333,7 @@ tokio = { version = "1.50.0", features = ["macros"] }
tokio-util = "0.7.12"
toml = "1.0.7+spec-1.1.0"
url = { version = "2.5.8", features = ["serde"] }
utoipa = { version = "4", features = ["chrono", "actix_extras"] }
utoipa = { version = "5.4.0", features = ["chrono", "actix_extras", "url"] }
uuid = "1.22.0"
walkdir = "2.4.0"
@@ -1,11 +1,12 @@
use serde_derive::{Deserialize, Serialize};
use url::Url;
use utoipa::ToSchema;
// TODO(bt,2025-08-20): Replace the storyteller-web version of this.
// All it needs is the impl ported into a builder.
/// Cover image links can only be jpg, png, etc. No videos.
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct CoverImageLinks {
/// Primary link to the cover image via the CDN.
pub cdn_url: Url,
@@ -1,5 +1,6 @@
use crate::common::responses::cover_image_links::CoverImageLinks;
use serde_derive::{Deserialize, Serialize};
use utoipa::ToSchema;
// TODO(bt,2025-08-20): Replace the storyteller-web version of this.
// We can't drop the old version just yet due to the `impl` (easy)
@@ -8,7 +9,7 @@ use serde_derive::{Deserialize, Serialize};
/// Everything we need to create a cover image.
/// Cover images are small descriptive images that can be set for any media file.
/// If a cover image is set, this is the path to the asset.
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct MediaFileCoverImageDetails {
// /// (DEPRECATED) URL path to the media file
// #[deprecated(note="This field doesn't point to the full URL. Use media_links instead to leverage the CDN.")]
@@ -36,7 +37,7 @@ pub struct MediaFileCoverImageDetails {
/// The default cover is composed of an image and color pair that are
/// predefined by the frontend.
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct MediaFileDefaultCover {
pub image_index: u8,
pub color_index: u8,
@@ -1,8 +1,9 @@
use serde_derive::{Deserialize, Serialize};
use tokens::tokens::users::UserToken;
use utoipa::ToSchema;
/// Everything we need to refer to a user on the public web interface.
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct UserDetailsLight {
/// The token for the user
pub user_token: UserToken,
@@ -26,7 +27,7 @@ pub struct UserDetailsLight {
// In the future, we'll also support user-uploaded avatars that we store on our servers.
}
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct UserDefaultAvatarInfo {
pub image_index: u8,
pub color_index: u8,
@@ -38,6 +38,7 @@ language-tags = "0.3.2" # Parsing single tags richly
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
utoipa = { workspace = true }
[dev-dependencies]
# (None yet)
@@ -1,7 +1,7 @@
use actix_web::HttpResponse;
use actix_web::web::Json;
#[derive(Serialize)]
#[derive(Serialize, utoipa::ToSchema)]
pub struct SimpleGenericJsonSuccess {
pub success: bool,
}
@@ -33,6 +33,7 @@ r2d2.workspace = true
redis.workspace = true
url.workspace = true
serde.workspace = true
utoipa.workspace = true
[dev-dependencies]
# None yet
@@ -2,13 +2,14 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use url::Url;
use utoipa::ToSchema;
use errors::{anyhow, AnyhowResult};
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
use crate::keys::inference_job::style_transfer_progress_key::StyleTransferProgressKey;
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, ToSchema)]
pub struct InferenceStageDetails {
pub stage_progress: u32,
pub expected_frame_count: u32,
@@ -17,7 +18,7 @@ pub struct InferenceStageDetails {
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, ToSchema)]
pub struct InferenceProgressDetailsResponse {
pub expected_stages: u32,
pub currently_active_stage: u32,
@@ -2,11 +2,12 @@ use std::fmt::Debug;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;
use crate::prefixes::TokenPrefix;
/// Primary key for the `user_subscriptions` table.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize, ToSchema)]
#[cfg_attr(feature = "database", derive(sqlx::Type))]
#[cfg_attr(feature = "database", sqlx(transparent))]
pub struct UserSubscriptionToken(pub String);
@@ -178,7 +178,7 @@ toml.workspace = true
async-trait = "0.1.58"
utoipa.workspace = true
utoipa-swagger-ui = { version = "7", features = ["actix-web"] }
utoipa-swagger-ui = { version = "9", features = ["actix-web"] }
# TODO: move zip pieces into a separate library that encapsulates calls to this lib
zip = "0.6.6"
@@ -5,7 +5,7 @@ use mysql_queries::errors::mysql_error::{MysqlCrateErrorSubtype, MysqlError};
use std::error::Error;
use std::fmt::{Display, Formatter};
#[derive(Debug)]
#[derive(Debug, utoipa::ToSchema)]
pub enum CommonWebError {
// TODO: Bad input with error fields vector.
/// Bad input with a user-facing error message.
@@ -23,7 +23,7 @@ const CLIENT_WAIT_FOR_RETRY_MILLIS: u64 = 1_000 * 60 * 1; // Every minute
tag = "Analytics",
path = "/v1/analytics/active_user",
responses(
(status = 200, description = "Success", body = LogAppActiveUserSuccessResponse),
(status = 200, description = "Success", body = LogAppActiveUserResponse),
),
params(
("request" = LogAppActiveUserRequest, description = "Payload for Request"),
@@ -22,7 +22,7 @@ const CLIENT_WAIT_FOR_RETRY_MILLIS: u64 = 1_000 * 60 * 1; // Every minute
path = "/v1/analytics/active_user_v2",
request_body = LogAppActiveUserRequest,
responses(
(status = 200, description = "Success", body = LogAppActiveUserSuccessResponse),
(status = 200, description = "Success", body = LogAppActiveUserResponse),
),
)]
pub async fn log_app_active_user_json_handler(
@@ -17,6 +17,7 @@ use mysql_queries::queries::comments::delete_comment::{delete_comment, DeleteCom
use mysql_queries::queries::comments::get_comment::get_comment;
use tokens::tokens::comments::CommentToken;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
@@ -19,6 +19,7 @@ use tokens::tokens::media_files::MediaFileToken;
use tokens::tokens::model_weights::ModelWeightToken;
use tokens::tokens::users::UserToken;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
@@ -70,7 +70,7 @@ impl fmt::Display for GetIsFeaturedItemError {
get,
tag = "Featured Items",
path = "/v1/featured_item/is_featured/{entity_type}/{entity_token}",
request_body = GetIsFeaturedItemRequest,
request_body = GetIsFeaturedItemPathInfo,
responses(
(status = 200, body = GetIsFeaturedItemSuccessResponse),
(status = 400, body = GetIsFeaturedItemError),
@@ -28,10 +28,10 @@ use utoipa::ToSchema;
tag = "Generate Objects",
path = "/v1/generate/object/hunyuan_2.0_image_to_3d",
responses(
(status = 200, description = "Success", body = GenerateHunyuan2ImageTo3dResponse),
(status = 200, description = "Success", body = GenerateHunyuan20ImageTo3dResponse),
),
params(
("request" = GenerateHunyuan2ImageTo3dRequest, description = "Payload for Request"),
("request" = GenerateHunyuan20ImageTo3dRequest, description = "Payload for Request"),
)
)]
pub async fn generate_hunyuan_2_0_image_to_3d_handler(
@@ -10,7 +10,7 @@ use utoipa::ToSchema;
use enums::common::visibility::Visibility;
use http_server_common::request::get_request_ip::get_request_ip;
use http_server_common::response::response_success_helpers::simple_json_success;
use http_server_common::response::response_success_helpers::{simple_json_success, SimpleGenericJsonSuccess};
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
use mysql_queries::queries::media_files::edit::update_media_file_visibility::{update_media_file_visibility, UpdateMediaFileArgs};
use mysql_queries::queries::media_files::get::get_media_file::get_media_file;
@@ -9,6 +9,7 @@ use log::warn;
use utoipa::ToSchema;
use crate::http_server::common_requests::media_file_token_path_info::MediaFileTokenPathInfo;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
@@ -15,6 +15,7 @@ use mysql_queries::queries::media_files::get::get_media_file::get_media_file;
use tokens::tokens::media_files::MediaFileToken;
use crate::http_server::common_requests::media_file_token_path_info::MediaFileTokenPathInfo;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
@@ -40,7 +40,7 @@ pub struct ModeratorTokenInfoResponse {
pub maybe_payload: Option<String>,
}
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub enum ModeratorTokenInfoError {
ServerError,
Unauthorized,
@@ -11,6 +11,7 @@ use artcraft_api_defs::moderation::jobs::user::list_user_jobs::{
};
use mysql_queries::queries::generic_inference::web::list_user_jobs_for_moderation::list_user_jobs_for_moderation;
use tokens::tokens::users::UserToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -19,6 +19,7 @@ use mysql_queries::queries::users::user_profiles::get_user_profile_by_token::get
use tokens::tokens::users::UserToken;
use crate::http_server::session::lookup::user_session_feature_flags::UserSessionFeatureFlags;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
@@ -11,6 +11,7 @@ use artcraft_api_defs::moderation::wallet_ledger_entries::list_wallet_ledger_ent
};
use mysql_queries::queries::wallet_ledger_entries::list_wallet_ledger_entries_by_wallet::list_wallet_ledger_entries_by_wallet;
use tokens::tokens::wallets::WalletToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -11,6 +11,7 @@ use artcraft_api_defs::moderation::wallet_ledger_entries::moderator_get_wallet_l
};
use mysql_queries::queries::wallet_ledger_entries::get_wallet_ledger_entry_for_moderation::get_wallet_ledger_entry_for_moderation;
use tokens::tokens::wallet_ledger_entries::WalletLedgerEntryToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -11,6 +11,7 @@ use artcraft_api_defs::moderation::wallets::list_user_wallets::{
};
use mysql_queries::queries::wallets::list_user_wallets_for_moderation::list_user_wallets_for_moderation;
use tokens::tokens::users::UserToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -12,6 +12,7 @@ use artcraft_api_defs::moderation::wallets::moderator_add_banked_balance_to_wall
use enums::by_table::wallet_ledger_entries::wallet_ledger_entry_type::WalletLedgerEntryType;
use mysql_queries::queries::wallets::add_durable_banked_balance_to_wallet::add_durable_banked_balance_to_wallet;
use tokens::tokens::wallets::WalletToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -11,6 +11,7 @@ use artcraft_api_defs::moderation::wallets::moderator_get_wallet::{
};
use mysql_queries::queries::wallets::get_wallet_for_moderation::get_wallet_for_moderation;
use tokens::tokens::wallets::WalletToken;
use crate::http_server::common_responses::common_web_error::CommonWebError;
use crate::http_server::web_utils::user_session::require_moderator::{require_moderator, UseDatabase};
use crate::state::server_state::ServerState;
@@ -81,7 +81,7 @@ impl fmt::Display for ListTagsForEntityError {
(status = 500, description = "Server error", body = ListTagsForEntityError),
),
params(
("request" = ListTagsForEntityRequest, description = "Payload for Request"),
("request" = ListTagsForEntityPathInfo, description = "Payload for Request"),
)
)]
pub async fn list_tags_for_entity_handler(
@@ -20,6 +20,7 @@ use mysql_queries::queries::users::user_bookmarks::delete_user_bookmark::delete_
use mysql_queries::queries::users::user_bookmarks::get_user_bookmark_transactional_locking::{get_user_bookmark_transactional_locking, BookmarkIdentifier};
use tokens::tokens::user_bookmarks::UserBookmarkToken;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
@@ -108,13 +108,13 @@ impl fmt::Display for InferSeedVcError {
tag = "Voice Conversion",
path = "/v1/voice_conversion/seed_vc_inference",
responses(
(status = 200, description = "Success response", body = InferTtsSuccessResponse),
(status = 200, description = "Success response", body = InferSeedVcSuccessResponse),
(status = 400, description = "Bad input", body = InferSeedVcError),
(status = 401, description = "Not authorized", body = InferSeedVcError),
(status = 429, description = "Rate limited", body = InferSeedVcError),
(status = 500, description = "Server error", body = InferSeedVcError)
),
params(("request" = InferTtsRequest, description = "Payload for Request"))
params(("request" = InferSeedVcRequest, description = "Payload for Request"))
)]
pub async fn enqueue_infer_seed_vc_handler(
http_request: HttpRequest,
@@ -17,6 +17,7 @@ use mysql_queries::queries::model_weights::delete_weights::{
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
use tokens::tokens::model_weights::ModelWeightToken;
use artcraft_api_defs::common::responses::simple_generic_json_success::SimpleGenericJsonSuccess;
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
use crate::state::server_state::ServerState;
use crate::util::delete_role_disambiguation::{delete_role_disambiguation, DeleteRole};
@@ -16,7 +16,7 @@ use crate::state::server_state::ServerState;
use enums::by_table::media_files::media_file_type::MediaFileType;
use enums::by_table::model_weights::weights_types::WeightsType;
use enums::common::visibility::Visibility;
use http_server_common::response::response_success_helpers::simple_json_success;
use http_server_common::response::response_success_helpers::{simple_json_success, SimpleGenericJsonSuccess};
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
use markdown::simple_markdown_to_html::simple_markdown_to_html;
use mysql_queries::queries::media_files::get::get_media_file::get_media_file;
+3 -3
View File
@@ -5,14 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="SwaggerUI" />
<title>Storyteller API</title>
<link rel="stylesheet" href="//unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css" />
<link rel="stylesheet" href="//unpkg.com/swagger-ui-dist@5.32.0/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="//unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js" crossorigin></script>
<script src="//unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-standalone-preset.js" crossorigin></script>
<script src="//unpkg.com/swagger-ui-dist@5.32.0/swagger-ui-bundle.js" crossorigin></script>
<script src="//unpkg.com/swagger-ui-dist@5.32.0/swagger-ui-standalone-preset.js" crossorigin></script>
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({