CleanValidation.Extensions.Http
1.0.0
dotnet add package CleanValidation.Extensions.Http --version 1.0.0
NuGet\Install-Package CleanValidation.Extensions.Http -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CleanValidation.Extensions.Http" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CleanValidation.Extensions.Http" Version="1.0.0" />
<PackageReference Include="CleanValidation.Extensions.Http" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CleanValidation.Extensions.Http --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CleanValidation.Extensions.Http, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CleanValidation.Extensions.Http@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CleanValidation.Extensions.Http&version=1.0.0
#tool nuget:?package=CleanValidation.Extensions.Http&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CleanValidation.Extensions.Http π
ASP.NET integration for CleanValidation.
This package provides seamless mapping from IResult / IResult<T> (from CleanValidation.Core) into ASP.NET Core IActionResult types, enabling fluent and expressive return statements in your controller or endpoint layer.
β¨ Features
- β
Maps
SuccessResult<T>toOkObjectResult - β
Maps
ErrorResult<T>toBadRequestObjectResult - β
Maps
InvalidResult<T>toUnprocessableEntityObjectResult - β
Supports
ConflictResult<T>,NotFoundResult<T>,ProblemResult<T> - β
Simple
.ToActionResult()extension method for allIResult - β Consistent HTTP responses for clean architecture applications
π Getting Started
1. Add the NuGet package:
Install-Package CleanValidation.Extensions.Http
2. Use in Controller or Minimal API:
using CleanValidation.Extensions.Http;
User user = new("LΓvia", 21, "Lady");
IResult<User> result = SuccessResult<User>.Create(user);
IActionResult actionResult = result.ToActionResult();
3. Example Mapping:
return result.ToActionResult();
This will automatically return:
Ok(user)if result is aSuccessResult<T>BadRequest(...)if result is anErrorResult<T>UnprocessableEntity(...)if result is anInvalidResult<T>Conflict(...)if result is aConflictResult<T>NotFound(...)if result is aNotFoundResult<T>Problem(...)if result is aProblemResult<T>
π‘ Why Use It?
- Makes controllers and endpoints cleaner and less error-prone
- Eliminates repetitive response handling logic
- Promotes consistency across all HTTP layers
- Fits perfectly into CQRS, Minimal APIs, and RESTful patterns
π Example Test
User user = new("LΓvia", 21, "Lady");
IResult<User> result = SuccessResult<User>.Create(user);
IActionResult actionResult = result.ToActionResult();
Assert.NotNull(actionResult);
Assert.IsType<OkObjectResult>(actionResult);
Use CleanValidation.Extensions.Http to make your ASP.NET Core apps fluent, expressive, and consistent from validation to response.
π CleanValidation Ecosystem
| Package | Description |
|---|---|
CleanValidation.Core |
Fluent validation with Guard + Result<T> |
CleanValidation.Extensions.Http |
HTTP mapping of results to IActionResult |
CleanValidation.DependencyInjection |
Registers IValidator<T> via Scrutor |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- CleanValidation.Core (>= 1.0.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 229 | 6/24/2025 |