3534: Update the csv error code from InvalidIndexCsvDelimiter to InvalidDocumentCsvDelimiter r=Kerollmops a=irevoire

Fixes #3533

Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
bors[bot] 2023-02-23 07:05:12 +00:00 committed by GitHub
commit f62703cd67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -212,6 +212,7 @@ InvalidApiKeyName , InvalidRequest , BAD_REQUEST ;
InvalidApiKeyOffset , InvalidRequest , BAD_REQUEST ; InvalidApiKeyOffset , InvalidRequest , BAD_REQUEST ;
InvalidApiKeyUid , InvalidRequest , BAD_REQUEST ; InvalidApiKeyUid , InvalidRequest , BAD_REQUEST ;
InvalidContentType , InvalidRequest , UNSUPPORTED_MEDIA_TYPE ; InvalidContentType , InvalidRequest , UNSUPPORTED_MEDIA_TYPE ;
InvalidDocumentCsvDelimiter , InvalidRequest , BAD_REQUEST ;
InvalidDocumentFields , InvalidRequest , BAD_REQUEST ; InvalidDocumentFields , InvalidRequest , BAD_REQUEST ;
InvalidDocumentGeoField , InvalidRequest , BAD_REQUEST ; InvalidDocumentGeoField , InvalidRequest , BAD_REQUEST ;
InvalidDocumentId , InvalidRequest , BAD_REQUEST ; InvalidDocumentId , InvalidRequest , BAD_REQUEST ;
@ -220,7 +221,6 @@ InvalidDocumentOffset , InvalidRequest , BAD_REQUEST ;
InvalidIndexLimit , InvalidRequest , BAD_REQUEST ; InvalidIndexLimit , InvalidRequest , BAD_REQUEST ;
InvalidIndexOffset , InvalidRequest , BAD_REQUEST ; InvalidIndexOffset , InvalidRequest , BAD_REQUEST ;
InvalidIndexPrimaryKey , InvalidRequest , BAD_REQUEST ; InvalidIndexPrimaryKey , InvalidRequest , BAD_REQUEST ;
InvalidIndexCsvDelimiter , InvalidRequest , BAD_REQUEST ;
InvalidIndexUid , InvalidRequest , BAD_REQUEST ; InvalidIndexUid , InvalidRequest , BAD_REQUEST ;
InvalidSearchAttributesToCrop , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToCrop , InvalidRequest , BAD_REQUEST ;
InvalidSearchAttributesToHighlight , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToHighlight , InvalidRequest , BAD_REQUEST ;

View File

@ -160,19 +160,19 @@ pub async fn get_all_documents(
pub struct UpdateDocumentsQuery { pub struct UpdateDocumentsQuery {
#[deserr(default, error = DeserrQueryParamError<InvalidIndexPrimaryKey>)] #[deserr(default, error = DeserrQueryParamError<InvalidIndexPrimaryKey>)]
pub primary_key: Option<String>, pub primary_key: Option<String>,
#[deserr(default, try_from(char) = from_char_csv_delimiter -> DeserrQueryParamError<InvalidIndexCsvDelimiter>, error = DeserrQueryParamError<InvalidIndexCsvDelimiter>)] #[deserr(default, try_from(char) = from_char_csv_delimiter -> DeserrQueryParamError<InvalidDocumentCsvDelimiter>, error = DeserrQueryParamError<InvalidDocumentCsvDelimiter>)]
pub csv_delimiter: Option<u8>, pub csv_delimiter: Option<u8>,
} }
fn from_char_csv_delimiter( fn from_char_csv_delimiter(
c: char, c: char,
) -> Result<Option<u8>, DeserrQueryParamError<InvalidIndexCsvDelimiter>> { ) -> Result<Option<u8>, DeserrQueryParamError<InvalidDocumentCsvDelimiter>> {
if c.is_ascii() { if c.is_ascii() {
Ok(Some(c as u8)) Ok(Some(c as u8))
} else { } else {
Err(DeserrQueryParamError::new( Err(DeserrQueryParamError::new(
format!("csv delimiter must be an ascii character. Found: `{}`", c), format!("csv delimiter must be an ascii character. Found: `{}`", c),
Code::InvalidIndexCsvDelimiter, Code::InvalidDocumentCsvDelimiter,
)) ))
} }
} }

View File

@ -280,9 +280,9 @@ async fn replace_documents_bad_csv_delimiter() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found an empty string", "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", "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###" 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`", "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", "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###" snapshot!(json_string!(response), @r###"
{ {
"message": "csv delimiter must be an ascii character. Found: `🍰`", "message": "csv delimiter must be an ascii character. Found: `🍰`",
"code": "invalid_index_csv_delimiter", "code": "invalid_document_csv_delimiter",
"type": "invalid_request", "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###" snapshot!(json_string!(response), @r###"
{ {
"message": "Invalid value in parameter `csvDelimiter`: expected a string of one character, but found an empty string", "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", "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###" 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`", "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", "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###" snapshot!(json_string!(response), @r###"
{ {
"message": "csv delimiter must be an ascii character. Found: `🍰`", "message": "csv delimiter must be an ascii character. Found: `🍰`",
"code": "invalid_index_csv_delimiter", "code": "invalid_document_csv_delimiter",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_index_csv_delimiter" "link": "https://docs.meilisearch.com/errors#invalid_document_csv_delimiter"
} }
"###); "###);
} }