I want to understand the purpose of ProducesResponseType.
Microsoft defines as:
a filter that specifies the type of the value and status code returned by the action.
So I am curious what are consequences if
[ProducesResponseType(typeof(DepartmentDto), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
Documentation from the Microsoft: ProducesResponseTypeAttribute Class
I think it can come handy for non-success (200) return codes. Say if one of the failure status codes returns a model that describes the problem, you can specify that the status code in that case produces something different than the success case. You can read more about that and find examples here: https://learn.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-2.2