openapi cleanup

This commit is contained in:
2025-10-31 00:39:22 +01:00
parent 5ca7dc9678
commit 5b5916ff92
9 changed files with 204 additions and 620 deletions
+25 -2
View File
@@ -60,14 +60,17 @@ const PRESIGNED_URL_EXPIRY_SECONDS: u64 = 300;
#[derive(Deserialize, IntoParams, ToSchema)]
#[into_params(parameter_in = Query)]
pub struct DocumentListQuery {
#[schema(nullable)]
pub folder_id: Option<Uuid>,
#[serde(default)]
#[schema(nullable)]
pub include_descendants: Option<bool>,
pub query: Option<String>,
pub tags: Option<String>,
pub correspondents: Option<String>,
pub document_types: Option<String>,
#[serde(default = "default_document_status_filter")]
#[schema(default = "active")]
pub status: DocumentStatusFilter,
}
@@ -87,6 +90,7 @@ pub enum DocumentStatusFilter {
#[into_params(parameter_in = Query)]
pub struct AssetRequestQuery {
#[serde(default)]
#[schema(default = false)]
pub force: bool,
}
@@ -100,16 +104,22 @@ pub struct DocumentCheckQuery {
pub struct DocumentCheckResponse {
pub exists: bool,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub document_id: Option<Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub filename: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub version_id: Option<Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub version_number: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub created_at: Option<String>,
}
@@ -117,6 +127,7 @@ pub struct DocumentCheckResponse {
pub struct TagResponse {
pub id: Uuid,
pub label: String,
#[schema(nullable)]
pub color: Option<String>,
}
@@ -151,21 +162,29 @@ pub struct DocumentResponse {
pub filename: String,
pub title: String,
pub original_name: String,
#[schema(nullable)]
pub content_type: Option<String>,
#[schema(nullable)]
pub folder_id: Option<Uuid>,
pub created_at: String,
pub updated_at: String,
#[schema(nullable)]
pub deleted_at: Option<String>,
#[schema(nullable)]
pub issued_at: Option<String>,
#[schema(value_type = Object)]
pub metadata: Value,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub document_type_id: Option<Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub document_type: Option<DocumentTypeResponse>,
pub tags: Vec<TagResponse>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub correspondents: Vec<DocumentCorrespondentResponse>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(nullable)]
pub current_version: Option<DocumentVersionDetailResponse>,
}
#[derive(Serialize, ToSchema)]
@@ -181,11 +200,13 @@ pub struct BulkReanalyzeResponse {
#[derive(Deserialize, ToSchema)]
pub struct BulkMoveRequest {
pub document_ids: Vec<Uuid>,
#[schema(nullable)]
pub folder_id: Option<Uuid>,
}
#[derive(Deserialize, ToSchema)]
pub struct DocumentMetadataUpdate {
#[schema(value_type = Object)]
pub value: Value,
#[serde(default)]
#[schema(default = false)]
@@ -200,7 +221,7 @@ pub struct UpdateDocumentRequest {
#[schema(nullable, value_type = Option<String>)]
pub issued_at: Option<Value>,
#[serde(default)]
#[schema(nullable)]
#[schema(nullable, value_type = Object)]
pub metadata: Option<DocumentMetadataUpdate>,
#[serde(default)]
#[schema(nullable, value_type = Option<Uuid>)]
@@ -247,6 +268,7 @@ pub struct CorrespondentAssignmentInput {
pub struct AssignCorrespondentsRequest {
pub assignments: Vec<CorrespondentAssignmentInput>,
#[serde(default)]
#[schema(default = false)]
pub replace: bool,
}
@@ -284,6 +306,7 @@ pub struct BulkCorrespondentsRequest {
pub struct BulkReanalyzeSelectionRequest {
pub document_ids: Vec<Uuid>,
#[serde(default = "default_true")]
#[schema(default = true)]
pub force: bool,
}
@@ -316,7 +339,7 @@ pub struct UploadDocumentForm {
pub file: String,
#[schema(nullable)]
pub folder_id: Option<Uuid>,
#[schema(nullable)]
#[schema(nullable, value_type = Object)]
pub metadata: Option<Value>,
#[schema(nullable)]
pub title: Option<String>,