Make the feature experimental

This commit is contained in:
Kerollmops 2025-02-10 15:02:03 +01:00
parent 491d115c3c
commit 7d0d8f4445
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
7 changed files with 49 additions and 9 deletions

View file

@ -51,6 +51,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
edit_documents_by_function: Some(false),
contains_filter: Some(false),
network: Some(false),
get_task_documents_route: Some(false),
})),
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
{
@ -91,6 +92,8 @@ pub struct RuntimeTogglableFeatures {
pub contains_filter: Option<bool>,
#[deserr(default)]
pub network: Option<bool>,
#[deserr(default)]
pub get_task_documents_route: Option<bool>,
}
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
@ -101,6 +104,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
edit_documents_by_function,
contains_filter,
network,
get_task_documents_route,
} = value;
Self {
@ -109,6 +113,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
edit_documents_by_function: Some(edit_documents_by_function),
contains_filter: Some(contains_filter),
network: Some(network),
get_task_documents_route: Some(get_task_documents_route),
}
}
}
@ -120,6 +125,7 @@ pub struct PatchExperimentalFeatureAnalytics {
edit_documents_by_function: bool,
contains_filter: bool,
network: bool,
get_task_documents_route: bool,
}
impl Aggregate for PatchExperimentalFeatureAnalytics {
@ -134,6 +140,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
edit_documents_by_function: new.edit_documents_by_function,
contains_filter: new.contains_filter,
network: new.network,
get_task_documents_route: new.get_task_documents_route,
})
}
@ -157,6 +164,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
edit_documents_by_function: Some(false),
contains_filter: Some(false),
network: Some(false),
get_task_documents_route: Some(false),
})),
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
{
@ -190,6 +198,10 @@ async fn patch_features(
.unwrap_or(old_features.edit_documents_by_function),
contains_filter: new_features.0.contains_filter.unwrap_or(old_features.contains_filter),
network: new_features.0.network.unwrap_or(old_features.network),
get_task_documents_route: new_features
.0
.get_task_documents_route
.unwrap_or(old_features.get_task_documents_route),
};
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
@ -201,6 +213,7 @@ async fn patch_features(
edit_documents_by_function,
contains_filter,
network,
get_task_documents_route,
} = new_features;
analytics.publish(
@ -210,6 +223,7 @@ async fn patch_features(
edit_documents_by_function,
contains_filter,
network,
get_task_documents_route,
},
&req,
);