From 9eea142e2b152de388ccb6a796a275a28cda54a3 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 2 Jun 2022 11:11:07 +0200 Subject: [PATCH] feat(API-keys): Change immutable_field error message Change the immutable_field error message to fit the recent changes in the spec: https://github.com/meilisearch/specifications/pull/148/files/aa0a148ee31701c46baf1268d7655d8c9eb0eedc..84a9baff685a459d44292839c9ffc107db374936 --- meilisearch-auth/src/error.rs | 2 +- meilisearch-http/tests/auth/api_keys.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meilisearch-auth/src/error.rs b/meilisearch-auth/src/error.rs index dbf28b421..8be97daaf 100644 --- a/meilisearch-auth/src/error.rs +++ b/meilisearch-auth/src/error.rs @@ -28,7 +28,7 @@ pub enum AuthControllerError { ApiKeyNotFound(String), #[error("`uid` field value `{0}` is already an existing API key.")] ApiKeyAlreadyExists(String), - #[error("`{0}` field cannot be modified for the given resource.")] + #[error("The `{0}` field cannot be modified for the given resource.")] ImmutableField(String), #[error("Internal error: {0}")] Internal(Box), diff --git a/meilisearch-http/tests/auth/api_keys.rs b/meilisearch-http/tests/auth/api_keys.rs index 4eb1fdd6f..d7e7dad0f 100644 --- a/meilisearch-http/tests/auth/api_keys.rs +++ b/meilisearch-http/tests/auth/api_keys.rs @@ -1150,7 +1150,7 @@ async fn error_patch_api_key_indexes() { let (response, code) = server.patch_api_key(&uid, content).await; assert_eq!(400, code, "{:?}", &response); - let expected = json!({"message": "`indexes` field cannot be modified for the given resource.", + let expected = json!({"message": "The `indexes` field cannot be modified for the given resource.", "code": "immutable_field", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#immutable_field" @@ -1206,7 +1206,7 @@ async fn error_patch_api_key_actions() { let (response, code) = server.patch_api_key(&uid, content).await; assert_eq!(400, code, "{:?}", &response); - let expected = json!({"message": "`actions` field cannot be modified for the given resource.", + let expected = json!({"message": "The `actions` field cannot be modified for the given resource.", "code": "immutable_field", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#immutable_field" @@ -1254,7 +1254,7 @@ async fn error_patch_api_key_expiration_date() { let (response, code) = server.patch_api_key(&uid, content).await; assert_eq!(400, code, "{:?}", &response); - let expected = json!({"message": "`expiresAt` field cannot be modified for the given resource.", + let expected = json!({"message": "The `expiresAt` field cannot be modified for the given resource.", "code": "immutable_field", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#immutable_field"