diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index 4858b2886..a201db7ac 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -212,6 +212,7 @@ InvalidApiKeyName , InvalidRequest , BAD_REQUEST ; InvalidApiKeyOffset , InvalidRequest , BAD_REQUEST ; InvalidApiKeyUid , InvalidRequest , BAD_REQUEST ; InvalidContentType , InvalidRequest , UNSUPPORTED_MEDIA_TYPE ; +InvalidDocumentCsvDelimiter , InvalidRequest , BAD_REQUEST ; InvalidDocumentFields , InvalidRequest , BAD_REQUEST ; InvalidDocumentGeoField , InvalidRequest , BAD_REQUEST ; InvalidDocumentId , InvalidRequest , BAD_REQUEST ; @@ -220,7 +221,6 @@ InvalidDocumentOffset , InvalidRequest , BAD_REQUEST ; InvalidIndexLimit , InvalidRequest , BAD_REQUEST ; InvalidIndexOffset , InvalidRequest , BAD_REQUEST ; InvalidIndexPrimaryKey , InvalidRequest , BAD_REQUEST ; -InvalidIndexCsvDelimiter , InvalidRequest , BAD_REQUEST ; InvalidIndexUid , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToCrop , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToHighlight , InvalidRequest , BAD_REQUEST ; diff --git a/meilisearch/src/routes/indexes/documents.rs b/meilisearch/src/routes/indexes/documents.rs index 3f694b5d1..f222f5b69 100644 --- a/meilisearch/src/routes/indexes/documents.rs +++ b/meilisearch/src/routes/indexes/documents.rs @@ -160,19 +160,19 @@ pub async fn get_all_documents( pub struct UpdateDocumentsQuery { #[deserr(default, error = DeserrQueryParamError)] pub primary_key: Option, - #[deserr(default, try_from(char) = from_char_csv_delimiter -> DeserrQueryParamError, error = DeserrQueryParamError)] + #[deserr(default, try_from(char) = from_char_csv_delimiter -> DeserrQueryParamError, error = DeserrQueryParamError)] pub csv_delimiter: Option, } fn from_char_csv_delimiter( c: char, -) -> Result, DeserrQueryParamError> { +) -> Result, DeserrQueryParamError> { if c.is_ascii() { Ok(Some(c as u8)) } else { Err(DeserrQueryParamError::new( format!("csv delimiter must be an ascii character. Found: `{}`", c), - Code::InvalidIndexCsvDelimiter, + Code::InvalidDocumentCsvDelimiter, )) } } diff --git a/meilisearch/tests/documents/errors.rs b/meilisearch/tests/documents/errors.rs index 7ee3132d6..bf55188ba 100644 --- a/meilisearch/tests/documents/errors.rs +++ b/meilisearch/tests/documents/errors.rs @@ -280,9 +280,9 @@ async fn replace_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found an empty string", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); @@ -292,9 +292,9 @@ async fn replace_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found the following string of 5 characters: `doggo`", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); @@ -305,9 +305,9 @@ async fn replace_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "csv delimiter must be an ascii character. Found: `🍰`", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); } @@ -323,9 +323,9 @@ async fn update_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found an empty string", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); @@ -335,9 +335,9 @@ async fn update_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found the following string of 5 characters: `doggo`", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); @@ -352,9 +352,9 @@ async fn update_documents_bad_csv_delimiter() { snapshot!(json_string!(response), @r###" { "message": "csv delimiter must be an ascii character. Found: `🍰`", - "code": "invalid_index_csv_delimiter", + "code": "invalid_document_csv_delimiter", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" + "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter" } "###); }