Skip to content

Commit 0bd9523

Browse files
committed
- add more information to readme about MinimalEndpoint
1 parent 5e3a187 commit 0bd9523

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ The WebResultEndpoint and ServiceResultEndpoint abstractions are a structured ap
1919
## Key Features
2020

2121
- Organizes ASP.NET Core Minimal Apis in REPR pattern endpoints
22-
- Encapsulates endpoint behaviors like request validation, request handling, and response mapping.
22+
- Encapsulates endpoint behaviors like request validation, request handling, and response mapping*.
2323
- Supports anything that Minimal Apis does. Configuration, parameter binding, authentication, Open Api tooling, filters, etc. are all Minimal Apis under the hood.
2424
- Supports auto discovery and registration.
2525
- Has built-in validation support with [FluentValidation](https://github.com/FluentValidation/FluentValidation). If a validator is registered for request model, request is automatically validated before being handled.
2626
- Supports constructor dependency injection in endpoint implementations.
2727
- Enforces response model type safety in request handlers.
2828
- Abstracts the logic for converting business results into HTTP responses.
2929

30+
*WebResultEndpoint abstracts the logic for converting business results into HTTP responses.
31+
3032
## Workflow
3133

3234
An endpoint must implement two virtual methods: Configure and HandleAsync.
@@ -280,10 +282,25 @@ See [test results](./samples/BenchmarkWebApi/BenchmarkFiles/inprocess_benchmark_
280282

281283
WebResultEndpoint and ServiceResultEndpoint, the two abstract endpoint bases, have a 'HandleAsync' method which returns a strongly typed [business result](https://github.com/modabas/ModResults).
282284

283-
They differ only in converting these business results into HTTP responses before sending response to client. Other features described previously are common for both of them.
285+
These two endpoint types differ only in converting these business results into HTTP responses before sending response to client.
286+
287+
MinimalEndpoint within ModEndpoints.Core package, is closest to barebones Minimal Api. Its 'HandleAsync' method support the following types of return values:
288+
289+
- string
290+
- T (Any other type)
291+
- Minimal Api IResult based
292+
293+
Other features described previously are common for all of them.
284294

285295
Each type of andpoint has various implementations that accept a request model or not, that has a response model or not.
286296

297+
### MinimalEndpoint
298+
299+
A MinimalEndpoint implementation, after handling request, returns the response model.
300+
301+
- MinimalEndpoint<TRequest, TResponse>: Has a request model, supports request validation and returns a response model.
302+
- MinimalEndpoint<TResponse>: Doesn't have a request model and returns a response model.
303+
287304
### ServiceResultEndpoint
288305

289306
A ServiceResultEndpoint implementation, after handling request, encapsulates the [business result](https://github.com/modabas/ModResults) of HandleAsync method in a HTTP 200 Minimal Api IResult and sends to client. The [business result](https://github.com/modabas/ModResults) returned may be in Ok or Failed state. This behaviour makes ServiceResultEndpoints more suitable for internal services, where clients are aware of Result or Result<TValue> implementations.
@@ -295,7 +312,7 @@ A ServiceResultEndpoint implementation, after handling request, encapsulates the
295312

296313
### WebResultEndpoint
297314

298-
A WebResultEndpoint implementation, after handling request, maps the [business result](https://github.com/modabas/ModResults) of HandleAsync method to an IResult depending on the result type, state and failure type (if any). Mapping behaviour can be modified or replaced with a custom one.
315+
A WebResultEndpoint implementation, after handling request, maps the [business result](https://github.com/modabas/ModResults) of HandleAsync method to a Minimal Api IResult depending on the business result type, state and failure type (if any). Mapping behaviour can be modified or replaced with a custom one.
299316

300317
- WebResultEndpoint<TRequest, TResponse>: Has a request model, supports request validation and returns a response model as body of Minimal Api IResult if successful.
301318
- WebResultEndpoint<TRequest>: Has a request model, supports request validation, doesn't have a response model to return within Minimal Api IResult.

0 commit comments

Comments
 (0)