PopValidations 0.9.0
See the version list below for details.
dotnet add package PopValidations --version 0.9.0
NuGet\Install-Package PopValidations -Version 0.9.0
<PackageReference Include="PopValidations" Version="0.9.0" />
paket add PopValidations --version 0.9.0
#r "nuget: PopValidations, 0.9.0"
// Install PopValidations as a Cake Addin #addin nuget:?package=PopValidations&version=0.9.0 // Install PopValidations as a Cake Tool #tool nuget:?package=PopValidations&version=0.9.0
PopValidation uses a fluent based style, to bring effective validation, with strong typing, using lambda expressions and generics.
Usage
Pop Validations, is usable for both public and corporate use, without need for compensation, or mention. Feature or bugfix PR's, including appropriate tests are more than welcome.
Developers
The core developer is Adam Williamson(https://github.com/AdamWilliamson), with help from Andrew Williamson (https://github.com/AWilliamson88)
Example
PopValidation provides a class "AbstractValidator", that you can inherit which provides the functions "Describe" and "DescribeEnumerable", which form the basis for all of the valiations, allowing you to select a field and describe the validations for that field.
An example
using PopValidation;
public record Song(string? Title, double Duration);
public class SongValidator: AbstractValidator<Song>
{
public SongValidator()
{
RuleFor(x => x.Title).Vitally().NotEmpty();
RuleFor(x => x.Duration)
.IsNotNull()
.IsLessThan(10.0, options => options.WithErrorMessage("Songs must be less than 10 minutes long."));
}
}
// Instantiate the Validation Runner.
var runner = new ValidationRunner<Song>(
new () { new SongValidator() },
new MessageProcessor()
);
// Run the Validation System.
var results = await runner.Validate(new Song("A Song", 5.5));
// Determine failures;
var isFailure = results.Errors.Any();
Full Documentation
Full documentation can be found at https://adamwilliamson.github.io/popvalidations/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Linq.Expressions (>= 4.3.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on PopValidations:
Package | Downloads |
---|---|
PopValidations.MediatR
MediatR Integration for PopValidations |
|
PopValidations.Swashbuckle
Swashbuckle Integration for PopValidations |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 257 | 12/24/2023 |
1.0.0-prerelease | 127 | 12/1/2023 |
0.9.0.1 | 213 | 11/3/2023 |
0.9.0 | 173 | 10/29/2023 |
Working towards V1. This contains the basics needed to validate any level of object complexity.