Error responses should include the standard response body

Description

Overview

In we introduced two new API endpoints:

  • GET /users-keycloak/auth-users/{userId}

  • POST /users-keycloak/auth-users/{userId}

The error responses (4xx/5xx) should include the standard response body. See

Acceptance Criteria

  • All 4xx/5xx responses include a body conforming to the schema linked above.

  • Reasonable error messages are included in the response, e.g. indicating that the specified user does not have a username

  • Tests have been updated as needed

Approach

  • Use the ApiExceptionHandler which automatically maps the exception to the appropriate error response.

  • Update the OpenAPI spec as needed.

Environment

None

Potential Workaround

None

Attachments

3

Checklist

hide

Activity

Show:

Yauhen Viazau August 2, 2024 at 12:04 PM
Edited

Re-tested on evrk2 - works as expected

Response to GET request with 404 status contains body with error message:

The same for POST call with 404 status response.

Mykola Makhin August 2, 2024 at 12:01 PM
Edited

Fixed GET 404 to have response body as well

Note you can get 404 on POST as well - if you use ID of a non-existent user (e.g. some random UUID)

Yauhen Viazau August 2, 2024 at 10:09 AM

Tested on evrk2
GET - 404 - no response body

POST - 400 - error message in response body

Yauhen Viazau July 16, 2024 at 7:52 AM

QA note: update the following TCs with proper response messages when this ticket is in QA:

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Eureka

Fix versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created July 15, 2024 at 9:00 PM
Updated August 19, 2024 at 11:54 AM
Resolved August 2, 2024 at 1:23 PM
TestRail: Cases
TestRail: Runs