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" />
                    
Directory.Packages.props
<PackageReference Include="CleanValidation.Extensions.Http" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=CleanValidation.Extensions.Http&version=1.0.0
                    
Install as a Cake Tool

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> to OkObjectResult
  • βœ… Maps ErrorResult<T> to BadRequestObjectResult
  • βœ… Maps InvalidResult<T> to UnprocessableEntityObjectResult
  • βœ… Supports ConflictResult<T>, NotFoundResult<T>, ProblemResult<T>
  • βœ… Simple .ToActionResult() extension method for all IResult
  • βœ… 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 a SuccessResult<T>
  • BadRequest(...) if result is an ErrorResult<T>
  • UnprocessableEntity(...) if result is an InvalidResult<T>
  • Conflict(...) if result is a ConflictResult<T>
  • NotFound(...) if result is a NotFoundResult<T>
  • Problem(...) if result is a ProblemResult<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 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.

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 134 6/24/2025