Skip to content

Latest commit

 

History

History
13 lines (6 loc) · 1.41 KB

README.md

File metadata and controls

13 lines (6 loc) · 1.41 KB

API Response

A simple elegant library to handle returning responses from Mediator handlers back to REST API handlers implementing the Operation Result pattern.

Often when developing public or internal REST API's it's best to define a standard structure and format of your response objects. The primary reason behind this is two fold, the most important being that you want to simplify the cognitive load required for users to become familiar and use your API. Secondly, it will be easier for your developers to implement various API calls, because they know exactly what is required and they then only have to focus on the business logic implementation.

When implementing a Vertical Slice Architecture and REPR pattern and relying on a Mediatr or another Mediator pattern implementation pattern you will often need to inform your REST Endpoint of whether a handler action was successful or not and also include sanitised error information to the client.

The Operation Result pattern

The role of the Operation Result pattern is to give an operation the possibility to return a complex result that describes whether the operation was successful and that can contain more information, like an actual result.