Skip to content

Commit c74eba4

Browse files
committed
docs(readme): add CSharpFunctionalExtensions.HttpResults
1 parent c4636ec commit c74eba4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,36 @@ result.Should().SucceedWith(69); // throws
607607
result.Should().Fail(); // throws
608608
```
609609

610+
## Web APIs / HttpResults
611+
612+
### [CSharpFunctionalExtensions.HttpResults](https://github.com/co-IT/CSharpFunctionalExtensions.HttpResults)
613+
614+
This library provides convenient extension methods to seamlessly map Results from [CSharpFunctionalExtensions](https://github.com/vkhorikov/CSharpFunctionalExtensions) to HttpResults. With this, it streamlines your Web API resulting in cleaner, more fluent code.
615+
616+
#### Key Benefits
617+
618+
- ⚙️ **Zero Configuration:** Get started immediately — the mapping works out of the box without any configuration.
619+
- 🛠️ **Customizable Mappings:** Tailor default mappings or define custom mappings for specific use cases.
620+
- 🔗 **Fluent API:** Maintain a smooth, railway-oriented flow by chaining HttpResult mappings at the end of your Result chain.
621+
- 🧱 **Separation of Domain and HTTP Errors:** Keeps domain errors distinct from HTTP errors, improving maintainability and clarity between business logic and web API concerns.
622+
-**Minimal APIs & Controllers Support:** Works with both Minimal APIs and traditional controllers in ASP.NET.
623+
- 📦 **Full Support for ASP.NET Results:** Supports all built-in HTTP response types in ASP.NET, including `Ok`, `Created`, `NoContent`, `Accepted`, `FileStream`, and more.
624+
- 🦺 **Typed Results:** Utilizes `TypedResults` for consistent, type-safe API responses.
625+
- 📑 **OpenAPI Ready:** Ensures accurate OpenAPI generation for clear and reliable API documentation.
626+
- 🛡️ **RFC Compliance:** Default mappings adhere to the RFC 9457 standard (`ProblemDetails`), ensuring your API errors are standardized and interoperable.
627+
- 🧑‍💻 **Developer-Friendly:** Includes built-in analyzers and source generators to speed up development and reduce errors.
628+
629+
#### Example
630+
631+
```csharp
632+
app.MapGet("/books", (BookService service) =>
633+
service.Get() //Result<Book[]>
634+
.ToOkHttpResult() //Results<Ok<Book[]>, ProblemHttpResult>
635+
);
636+
```
637+
638+
Check the repo out [here](https://github.com/co-IT/CSharpFunctionalExtensions.HttpResults).
639+
610640
## Analyzers
611641

612642
### [CSharpFunctionalExtensions.Analyzers](https://github.com/AlmarAubel/CSharpFunctionalExtensions.Analyzers)

0 commit comments

Comments
 (0)