193
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
This is another reason why explicit returned types
are better than dynamic types, in the long term.
When using the
ProducesResponseType
attribute, you can also specify what is
the expected outcome
regarding possible HTTP errors/codes, like 200, 400, etc.
In
the following image, you can see how Swagger UI shows the ResponseType information.
Figure 7-5. Swagger UI showing response types and possible HTTP status codes from a Web API
The image shows some example values based on the ViewModel types and
the possible HTTP status
codes that can be returned.
Dostları ilə paylaş: