RKSoftware.Packages.ApiRequestValidation
8.0.1-preview.1
This is a prerelease version of RKSoftware.Packages.ApiRequestValidation.
dotnet add package RKSoftware.Packages.ApiRequestValidation --version 8.0.1-preview.1
NuGet\Install-Package RKSoftware.Packages.ApiRequestValidation -Version 8.0.1-preview.1
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="RKSoftware.Packages.ApiRequestValidation" Version="8.0.1-preview.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RKSoftware.Packages.ApiRequestValidation --version 8.0.1-preview.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RKSoftware.Packages.ApiRequestValidation, 8.0.1-preview.1"
#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.
// Install RKSoftware.Packages.ApiRequestValidation as a Cake Addin #addin nuget:?package=RKSoftware.Packages.ApiRequestValidation&version=8.0.1-preview.1&prerelease // Install RKSoftware.Packages.ApiRequestValidation as a Cake Tool #tool nuget:?package=RKSoftware.Packages.ApiRequestValidation&version=8.0.1-preview.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Automatic validation for API request parameters (.NET)
Repository contains functionality for validation API requests.
Package | Current version and Downloads |
---|---|
RKSoftware.Packages.ApiRequestValidation |
About
This package contains ActionExecutingContext
extensions for validation URL parameters together with Body, Form and Query model validation.
- If an
id
in URLposts/{id}/pages
is empty, an endpoint returns Not Found response. - If a model next to
[FromBody]
,[FromForm]
or[FromQuery]
is not valid, an endpoint returns Bad Request response withValidationProblemDetails
model. It usesFluentValidation
(https://github.com/FluentValidation/FluentValidation) for validating models.
How To Use
Create
FluentValidation
model validator in accordance with documentation https://docs.fluentvalidation.net/en/latest/start.html.Register created validator
builder.Services.AddScoped<IValidator<BodyModel>, BodyModelValidator>();
or register all created validators from the same assembly
builder.Services.AddValidatorsFromAssemblyContaining<BodyModelValidator>();
- The package contains
ApiRequestValidation
attribute, which can be set on a controller or its method.
[ApiRequestValidation]
public class MyController : Controller
{
}
or
public class MyController : Controller
{
[ApiRequestValidation]
[HttpPost("posts/{id}/pages")]
public async Task<IActionResult> Create(string id, [FromBody] BodyModel body, [FromQuery] QueryModel query)
{
...
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- FluentValidation (>= 11.9.1)
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 |
---|---|---|
8.0.1-preview.1 | 529 | 4/24/2024 |
8.0.1-beta.1 | 51 | 4/24/2024 |
8.0.1-beta | 139 | 4/24/2024 |
8.0.1-alpha | 330 | 2/10/2024 |
1.0.3 | 2,338 | 11/30/2022 |
1.0.2 | 293 | 11/30/2022 |
1.0.1 | 319 | 11/30/2022 |
1.0.0 | 294 | 11/30/2022 |