Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update user's info with empty body. Invalid error message. #275

Open
TetianaPerinha opened this issue Apr 18, 2024 · 5 comments · Fixed by #317, #293 or #279
Open

Update user's info with empty body. Invalid error message. #275

TetianaPerinha opened this issue Apr 18, 2024 · 5 comments · Fixed by #317, #293 or #279
Assignees
Labels
bug Something isn't working good first issue Good for newcomers medium priority Medium priority issue

Comments

@TetianaPerinha
Copy link
Collaborator

Description: When sending a request to update user's info with an empty body, the app return a clear error message in string format.

Precondition: The user authorized and gets Bearer token

Steps to Reproduce: replace token with valid data
Send a PUT request to the endpoint http://localhost:8083/api/v1/users using the HTTP PUT method with an empty JSON object {} as the body.

curl --location --request PUT 'http://0.0.0.0:8083/api/v1/users'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {token}'{
}'

2. Observe response message.

Expected result: format message should be a string. "First name is the mandatory attribute" and "Last name is the mandatory attribute"

Actual result: format message is list dictionary.

image

@TetianaPerinha TetianaPerinha added bug Something isn't working good first issue Good for newcomers medium priority Medium priority issue labels Apr 18, 2024
@SaiSamyuG
Copy link
Contributor

Hi @TetianaPerinha I would like to take up this issue. Could you assign it to me

@TetianaPerinha
Copy link
Collaborator Author

Hi @TetianaPerinha I would like to take up this issue. Could you assign it to me

Hey @DarsiSreelekha, I've assigned this task to you. If you have any questions, feel free to ask.

@SaiSamyuG
Copy link
Contributor

SaiSamyuG commented Jun 6, 2024

Hi @TetianaPerinha @Sunagatov

  1. To customize the error response for the update users api, the ideal approach I think would be adding custom error
    messages for fields in UpdateUserAccountRequest. Eg: @NotNull(message="First name is the mandatory attribute")
    for firstname and add an exception handler.
  2. But the class is a generated one from com.zufar.icedlatte.openapi.dto which is a mentioned dependency in pom.xml.
  3. Could you help me in modifying it if it's okay for you or else I will try another alternative approach if possible.

@TetianaPerinha
Copy link
Collaborator Author

Hi @TetianaPerinha @Sunagatov

  1. To customize the error response for the update users api, the ideal approach I think would be adding custom error
    messages for fields in UpdateUserAccountRequest. Eg: @NotNull(message="First name is the mandatory attribute")
    for firstname and add an exception handler.
  2. But the class is a generated one from com.zufar.icedlatte.openapi.dto which is a mentioned dependency in pom.xml.
  3. Could you help me in modifying it if it's okay for you or else I will try another alternative approach if possible.

@Sunagatov Could you help, please?

SaiSamyuG added a commit to SaiSamyuG/Iced-Latte that referenced this issue Jun 10, 2024
@SaiSamyuG
Copy link
Contributor

SaiSamyuG commented Jun 10, 2024

Hi @TetianaPerinha @Sunagatov

  1. To customize the error response for the update users api, the ideal approach I think would be adding custom error
    messages for fields in UpdateUserAccountRequest. Eg: @NotNull(message="First name is the mandatory attribute")
    for firstname and add an exception handler.
  2. But the class is a generated one from com.zufar.icedlatte.openapi.dto which is a mentioned dependency in pom.xml.
  3. Could you help me in modifying it if it's okay for you or else I will try another alternative approach if possible.

@Sunagatov Could you help, please?

Hi @TetianaPerinha @Sunagatov

  1. To customize the error response for the update users api, the ideal approach I think would be adding custom error
    messages for fields in UpdateUserAccountRequest. Eg: @NotNull(message="First name is the mandatory attribute")
    for firstname and add an exception handler.
  2. But the class is a generated one from com.zufar.icedlatte.openapi.dto which is a mentioned dependency in pom.xml.
  3. Could you help me in modifying it if it's okay for you or else I will try another alternative approach if possible.

I understood that the dto class UpdateUserAccountRequest is generated from openapi spec. So, have made necessary changes in the same and raised PR. Please review it.
#317

Sunagatov added a commit that referenced this issue Jun 15, 2024
[Issue #275] Fix. Error response of Update User API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers medium priority Medium priority issue
Projects
None yet
2 participants