fix the examples of the experimental-feature route

This commit is contained in:
Tamo 2025-01-13 11:40:57 +01:00
parent fd251c37bb
commit 5c7fa9b924
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -45,13 +45,13 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
tag = "Experimental features", tag = "Experimental features",
security(("Bearer" = ["experimental_features.get", "experimental_features.*", "*"])), security(("Bearer" = ["experimental_features.get", "experimental_features.*", "*"])),
responses( responses(
(status = OK, description = "Experimental features are returned", body = RuntimeTogglableFeatures, content_type = "application/json", example = json!( (status = OK, description = "Experimental features are returned", body = RuntimeTogglableFeatures, content_type = "application/json", example = json!(RuntimeTogglableFeatures {
{ vector_store: Some(true),
"metrics": false, metrics: Some(true),
"logsRoute": true, logs_route: Some(false),
"vectorSearch": false, edit_documents_by_function: Some(false),
} contains_filter: Some(false),
)), })),
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!( (status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
{ {
"message": "The Authorization header is missing. It must use the bearer authorization method.", "message": "The Authorization header is missing. It must use the bearer authorization method.",
@ -75,8 +75,9 @@ async fn get_features(
HttpResponse::Ok().json(features) HttpResponse::Ok().json(features)
} }
#[derive(Debug, Deserr, ToSchema)] #[derive(Debug, Deserr, ToSchema, Serialize)]
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)] #[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
#[serde(rename_all = "camelCase")]
#[schema(rename_all = "camelCase")] #[schema(rename_all = "camelCase")]
pub struct RuntimeTogglableFeatures { pub struct RuntimeTogglableFeatures {
#[deserr(default)] #[deserr(default)]
@ -129,13 +130,13 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
tag = "Experimental features", tag = "Experimental features",
security(("Bearer" = ["experimental_features.update", "experimental_features.*", "*"])), security(("Bearer" = ["experimental_features.update", "experimental_features.*", "*"])),
responses( responses(
(status = OK, description = "Experimental features are returned", body = RuntimeTogglableFeatures, content_type = "application/json", example = json!( (status = OK, description = "Experimental features are returned", body = RuntimeTogglableFeatures, content_type = "application/json", example = json!(RuntimeTogglableFeatures {
{ vector_store: Some(true),
"metrics": false, metrics: Some(true),
"logsRoute": true, logs_route: Some(false),
"vectorSearch": false, edit_documents_by_function: Some(false),
} contains_filter: Some(false),
)), })),
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!( (status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
{ {
"message": "The Authorization header is missing. It must use the bearer authorization method.", "message": "The Authorization header is missing. It must use the bearer authorization method.",