VOOZH about

URL: https://www.nuget.org/packages/WebApiSkeleton.Contracts.Validation/

⇱ NuGet Gallery | WebApiSkeleton.Contracts.Validation 1.1.1




WebApiSkeleton.Contracts.Validation 1.1.1

dotnet add package WebApiSkeleton.Contracts.Validation --version 1.1.1
 
 
NuGet\Install-Package WebApiSkeleton.Contracts.Validation -Version 1.1.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="WebApiSkeleton.Contracts.Validation" Version="1.1.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebApiSkeleton.Contracts.Validation" Version="1.1.1" />
 
Directory.Packages.props
<PackageReference Include="WebApiSkeleton.Contracts.Validation" />
 
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 WebApiSkeleton.Contracts.Validation --version 1.1.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebApiSkeleton.Contracts.Validation, 1.1.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.
#:package WebApiSkeleton.Contracts.Validation@1.1.1
 
 
#: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=WebApiSkeleton.Contracts.Validation&version=1.1.1
 
Install as a Cake Addin
#tool nuget:?package=WebApiSkeleton.Contracts.Validation&version=1.1.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

WebApiSkeleton.Contracts.Validation

WebApiSkeleton.Contracts.Validation contains MediatR PipelineBehavior implementation to validate incoming requests that implement using FluentValidation

Usage

Steps to add contract validation:

  • Create validators that are inherited from AbstractValidator<T> for needed requests
  • Use AddContractValidatorsFromAssembly (or AddValidatorsFromAssembly from FluentValidation) to add validators to DI
  • Add validation behaviors for requests in DI
    • One way is to call AddValidationPipelineBehaviorsFromAssembly that will automatically search for classes that are inherited from AbstractValidator and add for requests that are passed as a generic parameter in DI. If any of these requests are not returning the Result<A> type the InvalidOperationException is thrown.
      • NOTE: in this case ValidationBehavior for request is automatically added, so it is highly recommended to mind the order of IPipelineBehavior implementations added in DI.
    • Another way is to create ValidationBehavior implementations by calling method and then add it manually to DI by passing the pipelineBehavior as a service type and validationBehavior as implementation type. This way order of pipeline behaviors executed for each request is handled more clearly by the user, which is adding them.

Example

Example usage shown in

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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 (2)

Showing the top 2 NuGet packages that depend on WebApiSkeleton.Contracts.Validation:

Package Downloads
WebApiSkeleton.FileSystem.MinIO

Package containing implementation of file system based on Minio S3 storage.

WebApiSkeleton.Security

Package containing security core implementation that is based on MediatR and other WebApiSkeleton MediatR-related packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 488 4/21/2024
1.1.0 271 4/21/2024