mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-25 22:34:28 +01:00
Merge #3534
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:
commit
f62703cd67
@ -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 ;
|
||||
|
@ -160,19 +160,19 @@ pub async fn get_all_documents(
|
||||
pub struct UpdateDocumentsQuery {
|
||||
#[deserr(default, error = DeserrQueryParamError<InvalidIndexPrimaryKey>)]
|
||||
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>,
|
||||
}
|
||||
|
||||
fn from_char_csv_delimiter(
|
||||
c: char,
|
||||
) -> Result<Option<u8>, DeserrQueryParamError<InvalidIndexCsvDelimiter>> {
|
||||
) -> Result<Option<u8>, DeserrQueryParamError<InvalidDocumentCsvDelimiter>> {
|
||||
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,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
"###);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user