From 5309a37fb00f79b9a6b9813b3da252ed15395e5f Mon Sep 17 00:00:00 2001 From: Mubelotix Date: Wed, 6 Aug 2025 14:25:40 +0200 Subject: [PATCH] Fix many error code mistakes --- crates/meilisearch/src/routes/export.rs | 4 ++-- crates/meilisearch/src/routes/indexes/documents.rs | 14 +++++++------- crates/meilisearch/src/routes/indexes/mod.rs | 2 +- crates/meilisearch/src/routes/indexes/settings.rs | 8 ++++---- crates/meilisearch/src/routes/swap_indexes.rs | 2 +- crates/meilisearch/src/routes/tasks.rs | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crates/meilisearch/src/routes/export.rs b/crates/meilisearch/src/routes/export.rs index a4b6720d1..559d5e7d0 100644 --- a/crates/meilisearch/src/routes/export.rs +++ b/crates/meilisearch/src/routes/export.rs @@ -47,7 +47,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) { tag = "Export", security(("Bearer" = ["export", "*"])), responses( - (status = 202, description = "Export successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Export successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 1, "status": "enqueued", @@ -106,7 +106,7 @@ async fn export( analytics.publish(analytics_aggregate, &req); - Ok(HttpResponse::Ok().json(task)) + Ok(HttpResponse::Accepted().json(task)) } #[derive(Debug, Deserr, ToSchema, Serialize)] diff --git a/crates/meilisearch/src/routes/indexes/documents.rs b/crates/meilisearch/src/routes/indexes/documents.rs index 138f5140f..e54f284e9 100644 --- a/crates/meilisearch/src/routes/indexes/documents.rs +++ b/crates/meilisearch/src/routes/indexes/documents.rs @@ -306,7 +306,7 @@ impl Aggregate for DocumentsDeletionAggregator { ("documentId" = String, Path, example = "853", description = "Document Identifier", nullable = false), ), responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, @@ -423,7 +423,7 @@ pub struct BrowseQuery { params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), request_body = BrowseQuery, responses( - (status = 200, description = "Task successfully enqueued", body = PaginationView, content_type = "application/json", example = json!( + (status = 200, description = "Documents returned", body = PaginationView, content_type = "application/json", example = json!( { "results":[ { @@ -733,7 +733,7 @@ impl Aggregate for DocumentsAggregator { ), request_body = serde_json::Value, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, @@ -834,7 +834,7 @@ pub async fn replace_documents( ), request_body = serde_json::Value, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, @@ -1100,7 +1100,7 @@ async fn copy_body_to_file( ), request_body = Vec, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, @@ -1291,7 +1291,7 @@ impl Aggregate for EditDocumentsByFunctionAggregator { ), request_body = DocumentEditionByFunction, responses( - (status = 202, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, @@ -1389,7 +1389,7 @@ pub async fn edit_documents_by_function( security(("Bearer" = ["documents.delete", "documents.*", "*"])), params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": null, diff --git a/crates/meilisearch/src/routes/indexes/mod.rs b/crates/meilisearch/src/routes/indexes/mod.rs index 04b3e12c4..fe1792ff4 100644 --- a/crates/meilisearch/src/routes/indexes/mod.rs +++ b/crates/meilisearch/src/routes/indexes/mod.rs @@ -231,7 +231,7 @@ impl Aggregate for IndexCreatedAggregate { security(("Bearer" = ["indexes.create", "indexes.*", "*"])), request_body = IndexCreateRequest, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": "movies", diff --git a/crates/meilisearch/src/routes/indexes/settings.rs b/crates/meilisearch/src/routes/indexes/settings.rs index 308977a6e..7a810284b 100644 --- a/crates/meilisearch/src/routes/indexes/settings.rs +++ b/crates/meilisearch/src/routes/indexes/settings.rs @@ -98,7 +98,7 @@ macro_rules! make_setting_route { params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), request_body = $type, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": "movies", @@ -162,7 +162,7 @@ macro_rules! make_setting_route { params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), request_body = $type, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": "movies", @@ -530,7 +530,7 @@ make_setting_routes!( params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), request_body = Settings, responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": "movies", @@ -680,7 +680,7 @@ pub async fn get_all( security(("Bearer" = ["settings.update", "settings.*", "*"])), params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), responses( - (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 147, "indexUid": "movies", diff --git a/crates/meilisearch/src/routes/swap_indexes.rs b/crates/meilisearch/src/routes/swap_indexes.rs index 4a35d1a6d..3860bdd97 100644 --- a/crates/meilisearch/src/routes/swap_indexes.rs +++ b/crates/meilisearch/src/routes/swap_indexes.rs @@ -68,7 +68,7 @@ impl Aggregate for IndexSwappedAnalytics { security(("Bearer" = ["search", "*"])), request_body = Vec, responses( - (status = OK, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( + (status = ACCEPTED, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( { "taskUid": 3, "indexUid": null, diff --git a/crates/meilisearch/src/routes/tasks.rs b/crates/meilisearch/src/routes/tasks.rs index 95c105894..a4a5eea30 100644 --- a/crates/meilisearch/src/routes/tasks.rs +++ b/crates/meilisearch/src/routes/tasks.rs @@ -311,7 +311,7 @@ impl Aggregate for TaskFilterAnalytics