fix: resolve utoipa schema generation errors by removing unsupported description attributes and creating specific response types
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
@@ -13,7 +13,7 @@ use anyhow::{Result, anyhow};
|
||||
|
||||
use crate::compression_engine::{CompressionType, get_compression_engine};
|
||||
use crate::db;
|
||||
use crate::modes::server::common::{AppState, ApiResponse, ItemInfo, ItemContentInfo, TagsQuery, ListItemsQuery, ItemQuery};
|
||||
use crate::modes::server::common::{AppState, ApiResponse, ItemInfo, ItemContentInfo, TagsQuery, ListItemsQuery, ItemQuery, ItemInfoListResponse, ItemInfoResponse, ItemContentInfoResponse, MetadataResponse};
|
||||
use crate::common::is_binary::is_binary;
|
||||
|
||||
#[utoipa::path(
|
||||
@@ -22,7 +22,7 @@ use crate::common::is_binary::is_binary;
|
||||
summary = "List stored items",
|
||||
description = "Retrieve a paginated list of stored items with their metadata and tags. Items can be filtered by tags and sorted by creation time. Each item includes comprehensive metadata extracted during storage such as file type, encoding, size, and custom tags for organization.",
|
||||
responses(
|
||||
(status = 200, description = "Successfully retrieved paginated list of items with metadata and tags", body = ApiResponse<Vec<ItemInfo>>),
|
||||
(status = 200, description = "Successfully retrieved paginated list of items with metadata and tags", body = ItemInfoListResponse),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 500, description = "Internal server error - Failed to retrieve items from database")
|
||||
),
|
||||
@@ -127,7 +127,7 @@ pub async fn handle_list_items(
|
||||
summary = "Store new item",
|
||||
description = "Create a new item by uploading content. The content will be automatically compressed, analyzed for metadata (file type, encoding, etc.), and stored with a unique identifier. Binary detection is performed automatically, and various metadata plugins extract information like line counts, file types, and system information.",
|
||||
responses(
|
||||
(status = 201, description = "Successfully created new item with generated metadata and unique ID", body = ApiResponse<ItemInfo>),
|
||||
(status = 201, description = "Successfully created new item with generated metadata and unique ID", body = ItemInfoResponse),
|
||||
(status = 400, description = "Bad request - Invalid input data or malformed content"),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 500, description = "Internal server error - Failed to create item due to storage or processing error")
|
||||
@@ -213,7 +213,7 @@ pub async fn handle_delete_item(
|
||||
summary = "Get latest item with content",
|
||||
description = "Retrieve the most recently stored item including its content and metadata. If tags are specified, returns the latest item that matches ALL the given tags. For text content, the actual content is included in the response. For binary content, only metadata is returned unless allow_binary is true.",
|
||||
responses(
|
||||
(status = 200, description = "Successfully retrieved latest item with content and metadata. Content is included if item is text-based or allow_binary is true.", body = ApiResponse<ItemContentInfo>),
|
||||
(status = 200, description = "Successfully retrieved latest item with content and metadata. Content is included if item is text-based or allow_binary is true.", body = ItemContentInfoResponse),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 404, description = "Item not found - No items exist in the database or no items match the specified tag criteria"),
|
||||
(status = 500, description = "Internal server error - Failed to retrieve item content due to decompression or database error")
|
||||
@@ -279,7 +279,7 @@ pub async fn handle_get_item_latest(
|
||||
summary = "Get item with content",
|
||||
description = "Retrieve a specific item by its ID including both content and metadata. The content is automatically decompressed and returned as a string for text files. Binary files return only metadata unless allow_binary is explicitly set to true.",
|
||||
responses(
|
||||
(status = 200, description = "Successfully retrieved item with content and metadata. Content is included if item is text-based or allow_binary is true.", body = ApiResponse<ItemContentInfo>),
|
||||
(status = 200, description = "Successfully retrieved item with content and metadata. Content is included if item is text-based or allow_binary is true.", body = ItemContentInfoResponse),
|
||||
(status = 400, description = "Bad request - Invalid item ID (must be a positive integer)"),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 404, description = "Item not found - No item exists with the specified ID"),
|
||||
@@ -559,7 +559,7 @@ async fn get_item_raw_content(item: &db::Item, data_dir: &PathBuf, conn: &mut ru
|
||||
summary = "Get latest item metadata",
|
||||
description = "Retrieve comprehensive metadata for the most recently stored item. Metadata includes automatically extracted information such as file type, MIME type, encoding, line counts, file size, system information (user, hostname, etc.), and cryptographic hashes. If tags are specified, returns metadata for the latest item matching ALL the given tags.",
|
||||
responses(
|
||||
(status = 200, description = "Successfully retrieved latest item metadata as key-value pairs including file type, encoding, size, and system information", body = ApiResponse<HashMap<String, String>>),
|
||||
(status = 200, description = "Successfully retrieved latest item metadata as key-value pairs including file type, encoding, size, and system information", body = MetadataResponse),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 404, description = "Item not found - No items exist in the database or no items match the specified tag criteria"),
|
||||
(status = 500, description = "Internal server error - Failed to retrieve item metadata from database")
|
||||
@@ -621,7 +621,7 @@ pub async fn handle_get_item_latest_meta(
|
||||
summary = "Get item metadata",
|
||||
description = "Retrieve comprehensive metadata for a specific item by its ID. Metadata includes automatically extracted information such as file type, MIME type, encoding, line counts, file size, system information (user, hostname, process ID, etc.), cryptographic hashes (SHA256, MD5), and performance metrics (read time, read rate).",
|
||||
responses(
|
||||
(status = 200, description = "Successfully retrieved item metadata as key-value pairs including file type, encoding, size, and system information", body = ApiResponse<HashMap<String, String>>),
|
||||
(status = 200, description = "Successfully retrieved item metadata as key-value pairs including file type, encoding, size, and system information", body = MetadataResponse),
|
||||
(status = 400, description = "Bad request - Invalid item ID (must be a positive integer)"),
|
||||
(status = 401, description = "Unauthorized - Invalid or missing authentication credentials"),
|
||||
(status = 404, description = "Item not found - No item exists with the specified ID"),
|
||||
|
||||
Reference in New Issue
Block a user