FluentValidation.DependencyInjectionExtensions

A popular .NET validation library for building strongly-typed validation rules.

Latest version: 11.10.0 registry icon
Maintenance score
100
Safety score
100
Popularity score
100
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
11.10.0 0 0 0 0 0
11.9.2 0 0 0 0 0
11.9.1 0 0 0 0 0
11.9.0 0 0 0 0 0
11.8.1 0 0 0 0 0
11.8.0 0 0 0 0 0
11.7.1 0 0 0 0 0
11.7.0 0 0 0 0 0
11.6.0 0 0 0 0 0
11.5.2 0 0 0 0 0
11.5.1 0 0 0 0 0
11.5.0 0 0 0 0 0
11.4.0 0 0 0 0 0
11.3.0 0 0 0 0 0
11.2.2 0 0 0 0 0
11.2.1 0 0 0 0 0
11.2.0 0 0 0 0 0
11.1.1 0 0 0 0 0
11.1.0 0 0 0 0 0
11.0.3 0 0 0 0 0
11.0.2 0 0 0 0 0
11.0.1 0 0 0 0 0
11.0.0 0 0 0 0 0
10.4.0 0 0 0 0 0
10.3.6 0 0 0 0 0
10.3.5 0 0 0 0 0
10.3.4 0 0 0 0 0
10.3.3 0 0 0 0 0
10.3.1 0 0 0 0 0
10.3.0 0 0 0 0 0
10.2.3 0 0 0 0 0
10.2.2 0 0 0 0 0
10.2.1 0 0 0 0 0
10.2.0 0 0 0 0 0
10.1.0 0 0 0 0 0
10.0.4 0 0 0 0 0
10.0.3 0 0 0 0 0
10.0.2 0 0 0 0 0
10.0.1 0 0 0 0 0
10.0.0 0 0 0 0 0
9.5.4 0 0 0 0 0
9.5.3 0 0 0 0 0
9.5.2 0 0 0 0 0
9.5.1 0 0 0 0 0
9.5.0 0 0 0 0 0
9.4.0 0 0 0 0 0
9.3.0 0 0 0 0 0
9.2.0 0 0 0 0 0
9.1.3 0 0 0 0 0
9.1.2 0 0 0 0 0
9.1.1 0 0 0 0 0
9.1.0 0 0 0 0 0
9.0.1 0 0 0 0 0
8.6.3 0 0 0 0 0
8.6.2 0 0 0 0 0
8.6.1 0 0 0 0 0
8.6.0 0 0 0 0 0
8.5.1 0 0 0 0 0
8.5.0 0 0 0 0 0
8.4.0 0 0 0 0 0
8.3.0 0 0 0 0 0
8.2.2 0 0 0 0 0

Stability
Latest release:

11.10.0 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



FluentValidation

Build Status NuGet Nuget

Full Documentation

A validation library for .NET that uses a fluent interface and lambda expressions for building strongly-typed validation rules.


Supporting the project

If you use FluentValidation in a commercial project, please sponsor the project financially. FluentValidation is developed and supported by @JeremySkinner for free in his spare time and financial sponsorship helps keep the project going. You can sponsor the project via either GitHub sponsors or OpenCollective.


Get Started

FluentValidation can be installed using the Nuget package manager or the dotnet CLI.

dotnet add package FluentValidation

Review our documentation for instructions on how to use the package.


Example

using FluentValidation;

public class CustomerValidator: AbstractValidator<Customer> {
  public CustomerValidator() {
    RuleFor(x => x.Surname).NotEmpty();
    RuleFor(x => x.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount);
    RuleFor(x => x.Address).Length(20, 250);
    RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");
  }

  private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here
  }
}

var customer = new Customer();
var validator = new CustomerValidator();

// Execute the validator
ValidationResult results = validator.Validate(customer);

// Inspect any validation failures.
bool success = results.IsValid;
List<ValidationFailure> failures = results.Errors;

License, Copyright etc

FluentValidation has adopted the Code of Conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

FluentValidation is copyright © 2008-2022 .NET Foundation, Jeremy Skinner and other contributors and is licensed under the Apache2 license.

Sponsors

This project is sponsored by the following organisations whose support help keep this project going:

  • Microsoft for their financial contribution
  • JetBrains for providing licenses to their developer tools

This project is part of the .NET Foundation.