You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-142Lines changed: 1 addition & 142 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,13 +32,9 @@ public class GreetingWebApiEndpoint : IWebApiEndpoint
32
32
-[x] Full support and built on top of [minimal apis](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-7.0)
33
33
-[x] Full support for OpenApi
34
34
-[x] Full support for [TypedResults](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.typedresults?view=aspnetcore-7.0)
35
-
-[x][Full compatibility](#full-compatibility-with-futurumcore) with [Futurum.Core](https://www.nuget.org/packages/Futurum.Core)
36
35
-[x][Supports uploading file(s) with additional JSON payload](#uploading-files-with-additional-json-payload)
37
36
-[x] Api Versioning baked-in
38
37
-[x] Built in [sandbox runner](#sandbox-runner) with full [TypedResults support](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.typedresults?view=aspnetcore-7.0), catching unhandled exceptions and returning a [ProblemDetails](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.problemdetails?view=aspnetcore-7.0) response
Use the *FormFileWithPayload* type to upload a single file and a JSON payload
@@ -452,68 +390,6 @@ Use the *FormFilesWithPayload* type to upload multiple files and a JSON payload
452
390
}
453
391
```
454
392
455
-
## Full compatibility with [Futurum.Core](https://www.nuget.org/packages/Futurum.Core)
456
-
Comprehensive set of extension methods to transform a [Result](https://docs.futurum.dev/dotnet.futurum.core/result/overview.html) and [Result<T>](https://docs.futurum.dev/dotnet.futurum.core/result/overview.html) to an *TypedResult*.
457
-
458
-
- If the method passed in is a *success*, then the *IResult* will be returned.
459
-
- If the method passed in is a *failure*, then a *BadRequest<ProblemDetails>* will be returned, with the appropriate details set on the ProblemDetails. The *error message* will be safe to return to the client, that is, it will not contain any sensitive information e.g. StackTrace.
460
-
461
-
The returned type from *ToWebApi* is always augmented to additionally include *BadRequest<ProblemDetails>*
*Results* has a maximum of 6 types. So 5 are allowed leaving one space left for the *BadRequest<ProblemDetails>*.
476
-
477
-
#### How to handle *successful* and *failure* cases in a typed way with *TypedResult*
478
-
You can optionally specify which TypedResult success cases you want to handle. This is useful if you want to handle a specific successes case differently.
479
-
480
-
You can specify which TypedResult error cases you want to handle. This is useful if you want to handle a specific error case differently.
481
-
482
-
If you have a *success* case, you must pass in the the *success* helper function first, then the *failure* helper functions.
483
-
484
-
There can only be 1 *success* helper function, but there can be multiple *failure* helper functions.
485
-
486
-
##### Example use
487
-
The *ToWebApi* extension method will change the method return type to add *BadRequest<ProblemDetails>*, with the appropriate details set on the ProblemDetails. The *error message* will be safe to return to the client, that is, it will not contain any sensitive information e.g. StackTrace.
488
-
489
-
You can then pass in additional helper functions to deal with successes and failures and these will change the return type to the appropriate *TypedResult*'s.
490
-
491
-
*ToOk* is a function that will convert a *T* to an *Ok<T>*.
492
-
493
-
*ToValidationProblem* is a function that will convert a *ValidationResultError* to a *ValidationProblem*.
This means you can use the helper functions without having to specify the namespace. As in the examples.
516
-
517
393
### Success helper functions
518
394
#### ToOk
519
395
Converts a *T* to an *Ok<T>*.
@@ -562,21 +438,6 @@ This can be overridden by passing in a *string*.
562
438
ToAccepted<T>("/api/articles")
563
439
```
564
440
565
-
### Failure helper functions
566
-
#### ToNotFound
567
-
If a *ResultErrorKeyNotFound* has occured then it will convert it to a *NotFound<ProblemDetails>*, with the correct information set on the *ProblemDetails*.
568
-
569
-
```csharp
570
-
ToNotFound
571
-
```
572
-
573
-
#### ToValidationProblem
574
-
If a *ResultErrorValidation* has occured then it will convert it to a *ValidationProblem*, with the correct information set on the *HttpValidationProblemDetails*.
575
-
576
-
```csharp
577
-
ToValidationProblem
578
-
```
579
-
580
441
## Comprehensive samples
581
442
There are examples showing the following:
582
443
-[x] A basic blog CRUD implementation
@@ -585,15 +446,13 @@ There are examples showing the following:
0 commit comments