Lyo.Validation.Models 2.0.0

dotnet add package Lyo.Validation.Models --version 2.0.0
                    
NuGet\Install-Package Lyo.Validation.Models -Version 2.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="Lyo.Validation.Models" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Validation.Models" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Validation.Models" />
                    
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 Lyo.Validation.Models --version 2.0.0
                    
#r "nuget: Lyo.Validation.Models, 2.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 Lyo.Validation.Models@2.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=Lyo.Validation.Models&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Validation.Models&version=2.0.0
                    
Install as a Cake Tool

Lyo.Validation.Models

Lyo.Validation's contract half. Hosts that only exchange or persist validation rules — an API that returns ValidationSchema documents, a Postgres store that saves them — take these types and skip the validators, builders, and attributes that implement them.

The projection from a match explanation to errors lives here as well. WhereClauseExplainResult.ToErrors used to sit in Lyo.Query.Models, which made the query model reference Lyo.Result for one validation-only method. That edge went away when the method moved.

The Lyo.Validation namespace stayed on the types, so importers did not have to change when they moved.

Features

  • Schema documents. ValidationSchema — optional target type, key, WhereClause constraints, and per-field message overrides.
  • Message overrides. Dotted field paths key ValidationMessage and WhereClauseErrorOverride.
  • Contracts. IValidationRule<T>, IValidator<T>, IValidationSchemaCompiler, IValidationSchemaStore, IValidationClauseEvaluator.
  • Error projection. A failed explain tree becomes Lyo.Result.Errors through WhereClauseExplainResultExtensions.ToErrors.
  • Metadata keys. Each error attaches PropertyName / AttemptedValue via ValidationMetadataKeys.

Examples

Wire shape of a schema

using Lyo.Validation;

var schema = new ValidationSchema {
    Key = "signup.v2",
    TargetTypeName = nameof(CreateUserRequest),
    Constraints = new GroupClause(GroupOperatorEnum.And, [
        new ConditionClause("Email", ComparisonOperatorEnum.Regex, @"^[^@]+@[^@]+$"),
        new ConditionClause("Age", ComparisonOperatorEnum.GreaterThanOrEqual, 18),
    ]),
    Messages = new Dictionary<string, ValidationMessage> {
        ["Age"] = new() { ErrorCode = "AGE_MIN", ErrorMessage = "Must be 18 or older." },
    },
};

Package contents

  • ValidationMessage, ValidationSchema — the serializable rule document.
  • IValidationRule<T>, IValidator<T>, ValidationRule<T> — validation abstractions and the delegate-backed rule.
  • IValidationSchemaCompiler, IValidationSchemaStore — compile and load schemas.
  • IValidationClauseEvaluator — where a schema meets whatever evaluates its clause.
  • WhereClauseExplainResultExtensions, WhereClauseErrorOverride — explain tree to Error projection.
  • ValidationMetadataKeys — metadata keys emitted by validation rules.

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Exceptions (direct, lyo)
  • Lyo.Query.Models (direct, lyo)
  • Lyo.Result (direct, lyo)
  • Lyo.Common.Core (transitive, lyo)
  • Lyo.Common.Json (transitive, lyo)
  • Lyo.Common.Metadata (transitive, lyo)
  • Lyo.Parameters (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Lyo.Validation.Models:

Package Downloads
Lyo.Validation

Reusable validators and a fluent builder for validating strongly typed models with structured Result-based failures.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 435 9/9/2026