Updated all 404 and 500 responses to use problem details model (#14634)

* Updated all 404 and 500 responses to use problem details

* Updated OpenApi.json

* Add missing ProducesResponseType

* Updated OpenApi.json
This commit is contained in:
Bjarke Berg
2023-08-04 10:51:20 +02:00
committed by GitHub
parent 7b78fe9ced
commit 45033437a2
111 changed files with 1773 additions and 309 deletions

View File

@@ -25,16 +25,16 @@ public class ByKeyUserGroupController : UserGroupControllerBase
[HttpGet("{id:guid}")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(UserGroupResponseModel), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<UserGroupResponseModel>> ByKey(Guid id)
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> ByKey(Guid id)
{
IUserGroup? userGroup = await _userGroupService.GetAsync(id);
if (userGroup is null)
{
return NotFound();
return UserGroupNotFound();
}
return await _userGroupPresentationFactory.CreateAsync(userGroup);
return Ok(await _userGroupPresentationFactory.CreateAsync(userGroup));
}
}