From 13afdaf393ce735e0c48fd45dd1347b906b108b8 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 18 Dec 2024 17:13:57 +0100 Subject: [PATCH] finish rebase and update utoipa to the latest version --- Cargo.lock | 22 ++++++++++---------- crates/meilisearch-types/Cargo.toml | 2 +- crates/meilisearch-types/src/settings.rs | 6 +++++- crates/meilisearch-types/src/task_view.rs | 3 ++- crates/meilisearch/Cargo.toml | 8 +++---- crates/meilisearch/src/routes/batches.rs | 2 +- crates/meilisearch/src/routes/indexes/mod.rs | 1 - crates/meilisearch/src/routes/tasks.rs | 14 ++++++++----- crates/milli/Cargo.toml | 3 +-- 9 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b375a2616..fdb799787 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5964,9 +5964,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "utoipa" -version = "5.0.0-rc.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf66139459b75afa33caddb62bb2afee3838923b630b9e0ef38c369e543382f" +checksum = "514a48569e4e21c86d0b84b5612b5e73c0b2cf09db63260134ba426d4e8ea714" dependencies = [ "indexmap", "serde", @@ -5976,22 +5976,22 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "5.0.0-rc.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c136da726bb82a527afa1fdf3f4619eaf104e2982f071f25239cef1c67c79eb" +checksum = "5629efe65599d0ccd5d493688cbf6e03aa7c1da07fe59ff97cf5977ed0637f66" dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.60", + "syn 2.0.87", "uuid", ] [[package]] name = "utoipa-rapidoc" -version = "4.0.1-rc.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4d3324d5874fb734762214827dd30b47aa78510d12abab674a97f6d7c53688f" +checksum = "2f5e784e313457e79d65c378bdfc2f74275f0db91a72252be7d34360ec2afbe1" dependencies = [ "actix-web", "serde", @@ -6001,9 +6001,9 @@ dependencies = [ [[package]] name = "utoipa-redoc" -version = "4.0.1-rc.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4375bb6b0cb78a240c973f5e99977c482f3e92aeea1907367caa28776b9aaf9" +checksum = "9218304bba9a0ea5e92085b0a427ccce5fd56eaaf6436d245b7578e6a95787e1" dependencies = [ "actix-web", "serde", @@ -6013,9 +6013,9 @@ dependencies = [ [[package]] name = "utoipa-scalar" -version = "0.2.0-rc.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc122c11f9642b20b3be88b60c1a3672319811f139698ac6999e72992ac7c7e" +checksum = "c1291aa7a2223c2f8399d1c6627ca0ba57ca0d7ecac762a2094a9dfd6376445a" dependencies = [ "actix-web", "serde", diff --git a/crates/meilisearch-types/Cargo.toml b/crates/meilisearch-types/Cargo.toml index d0d136399..55db187b5 100644 --- a/crates/meilisearch-types/Cargo.toml +++ b/crates/meilisearch-types/Cargo.toml @@ -40,7 +40,7 @@ time = { version = "0.3.36", features = [ "macros", ] } tokio = "1.38" -utoipa = { version = "5.0.0-rc.0", features = ["macros"] } +utoipa = { version = "5.2.0", features = ["macros"] } uuid = { version = "1.10.0", features = ["serde", "v4"] } [dev-dependencies] diff --git a/crates/meilisearch-types/src/settings.rs b/crates/meilisearch-types/src/settings.rs index 92d61e28f..f7216a0cf 100644 --- a/crates/meilisearch-types/src/settings.rs +++ b/crates/meilisearch-types/src/settings.rs @@ -249,9 +249,12 @@ pub struct Settings { pub localized_attributes: Setting>, #[serde(default, skip_serializing_if = "Setting::is_not_set")] #[deserr(default, error = DeserrJsonError)] + #[schema(value_type = Option, example = json!(true))] pub facet_search: Setting, #[serde(default, skip_serializing_if = "Setting::is_not_set")] #[deserr(default, error = DeserrJsonError)] + #[schema(value_type = Option, example = json!("Hemlo"))] + // TODO: TAMO pub prefix_search: Setting, #[serde(skip)] @@ -1046,8 +1049,9 @@ impl std::ops::Deref for WildcardSetting { } } -#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Deserr, Serialize, Deserialize)] +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Deserr, Serialize, Deserialize, ToSchema)] #[serde(deny_unknown_fields, rename_all = "camelCase")] +#[schema(rename_all = "camelCase")] #[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)] pub enum PrefixSearchSettings { #[default] diff --git a/crates/meilisearch-types/src/task_view.rs b/crates/meilisearch-types/src/task_view.rs index 8a6720cc2..467408097 100644 --- a/crates/meilisearch-types/src/task_view.rs +++ b/crates/meilisearch-types/src/task_view.rs @@ -1,6 +1,7 @@ use milli::Object; use serde::{Deserialize, Serialize}; use time::{Duration, OffsetDateTime}; +use utoipa::ToSchema; use crate::batches::BatchId; use crate::error::ResponseError; @@ -66,7 +67,7 @@ impl TaskView { } } -#[derive(Default, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] +#[derive(Default, Debug, PartialEq, Eq, Clone, Serialize, Deserialize, ToSchema)] #[serde(rename_all = "camelCase")] pub struct DetailsView { /// Number of documents received for documentAdditionOrUpdate task. diff --git a/crates/meilisearch/Cargo.toml b/crates/meilisearch/Cargo.toml index 8a2f0c6c0..5094e6807 100644 --- a/crates/meilisearch/Cargo.toml +++ b/crates/meilisearch/Cargo.toml @@ -105,10 +105,10 @@ tracing-actix-web = "0.7.11" build-info = { version = "1.7.0", path = "../build-info" } roaring = "0.10.7" mopa-maintained = "0.2.3" -utoipa = { version = "5.0.0-rc.0", features = ["actix_extras", "macros", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] } -utoipa-scalar = { version = "0.2.0-rc.0", features = ["actix-web"] } -utoipa-rapidoc = { version = "4.0.1-rc.0", features = ["actix-web"] } -utoipa-redoc = { version = "4.0.1-rc.0", features = ["actix-web"] } +utoipa = { version = "5.2.0", features = ["actix_extras", "macros", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] } +utoipa-scalar = { version = "0.2.0", features = ["actix-web"] } +utoipa-rapidoc = { version = "5.0.0", features = ["actix-web"] } +utoipa-redoc = { version = "5.0.0", features = ["actix-web"] } [dev-dependencies] actix-rt = "2.10.0" diff --git a/crates/meilisearch/src/routes/batches.rs b/crates/meilisearch/src/routes/batches.rs index 36bf31605..7cdca0bf7 100644 --- a/crates/meilisearch/src/routes/batches.rs +++ b/crates/meilisearch/src/routes/batches.rs @@ -74,7 +74,7 @@ async fn get_batches( let next = if results.len() == limit as usize { results.pop().map(|t| t.uid) } else { None }; let from = results.first().map(|t| t.uid); - let tasks = AllBatches { results, limit: limit.saturating_sub(1), total, from, next }; + let tasks = AllBatches { results, limit: limit.saturating_sub(1) as u32, total, from, next }; Ok(HttpResponse::Ok().json(tasks)) } diff --git a/crates/meilisearch/src/routes/indexes/mod.rs b/crates/meilisearch/src/routes/indexes/mod.rs index f6881f70c..86e08ee2b 100644 --- a/crates/meilisearch/src/routes/indexes/mod.rs +++ b/crates/meilisearch/src/routes/indexes/mod.rs @@ -403,7 +403,6 @@ pub struct UpdateIndexRequest { )), ) )] ->>>>>>> 0f289a437 (Implements the get and delete tasks route):meilisearch/src/routes/indexes/mod.rs pub async fn update_index( index_scheduler: GuardedData, Data>, index_uid: web::Path, diff --git a/crates/meilisearch/src/routes/tasks.rs b/crates/meilisearch/src/routes/tasks.rs index ffcc01698..c01e0139c 100644 --- a/crates/meilisearch/src/routes/tasks.rs +++ b/crates/meilisearch/src/routes/tasks.rs @@ -20,9 +20,7 @@ use tokio::task; use utoipa::{IntoParams, OpenApi, ToSchema}; use super::{get_task_id, is_dry_run, SummarizedTaskView, PAGINATION_DEFAULT_LIMIT}; -use crate::analytics::Analytics; -use super::{get_task_id, is_dry_run, SummarizedTaskView}; -use crate::analytics::Analytics; +use crate::analytics::{Aggregate, AggregateMethod, Analytics}; use crate::extractors::authentication::policies::*; use crate::extractors::authentication::GuardedData; use crate::extractors::sequential_extractor::SeqHandler; @@ -55,8 +53,8 @@ pub fn configure(cfg: &mut web::ServiceConfig) { #[into_params(rename_all = "camelCase", parameter_in = Query)] pub struct TasksFilterQuery { /// Maximum number of results to return. - #[deserr(default = Param(DEFAULT_LIMIT), error = DeserrQueryParamError)] - #[param(required = false, value_type = u32, example = 12, default = json!(DEFAULT_LIMIT))] + #[deserr(default = Param(PAGINATION_DEFAULT_LIMIT as u32), error = DeserrQueryParamError)] + #[param(required = false, value_type = u32, example = 12, default = json!(PAGINATION_DEFAULT_LIMIT))] pub limit: Param, /// Fetch the next set of results from the given uid. #[deserr(default, error = DeserrQueryParamError)] @@ -66,6 +64,12 @@ pub struct TasksFilterQuery { #[deserr(default, error = DeserrQueryParamError)] #[param(required = false, value_type = Option, example = true)] pub reverse: Option>, + + /// Permits to filter tasks by their batch uid. By default, when the `batchUids` query parameter is not set, all task uids are returned. It's possible to specify several batch uids by separating them with the `,` character. + #[deserr(default, error = DeserrQueryParamError)] + #[param(required = false, value_type = Option, example = 12421)] + pub batch_uids: OptionStarOrList, + /// Permits to filter tasks by their uid. By default, when the uids query parameter is not set, all task uids are returned. It's possible to specify several uids by separating them with the `,` character. #[deserr(default, error = DeserrQueryParamError)] #[param(required = false, value_type = Option>, example = json!([231, 423, 598, "*"]))] diff --git a/crates/milli/Cargo.toml b/crates/milli/Cargo.toml index 01432ee21..27b6ae876 100644 --- a/crates/milli/Cargo.toml +++ b/crates/milli/Cargo.toml @@ -90,7 +90,6 @@ tracing = "0.1.40" ureq = { version = "2.10.0", features = ["json"] } url = "2.5.2" rayon-par-bridge = "0.1.0" -<<<<<<< HEAD:crates/milli/Cargo.toml hashbrown = "0.15.0" bumpalo = "3.16.0" bumparaw-collections = "0.1.2" @@ -101,7 +100,7 @@ uell = "0.1.0" enum-iterator = "2.1.0" bbqueue = { git = "https://github.com/meilisearch/bbqueue" } flume = { version = "0.11.1", default-features = false } -utoipa = { version = "5.0.0-rc.0", features = ["non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] } +utoipa = { version = "5.0.2", features = ["non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] } [dev-dependencies] mimalloc = { version = "0.1.43", default-features = false }