DEV Community

Cover image for Jeninnet.Validation v1.0.0-preview.1
Tarek
Tarek

Posted on

Jeninnet.Validation v1.0.0-preview.1

One Rule, Many Surfaces: Validation as a Design Concern

A first look at Jeninnet.Validation 1.0.0-preview.1

Release at a glance: 1.0.0-preview.1 · .NET 11 (STS) · C# 15 · 25 packages · 997 tests · MIT

NuGet ·
Documentation ·
Release notes

One rule, one engine, many surfaces. The same declaration feeds the API, the UI, the schema, the
client, and the tests.

Open a typical .NET solution and count where the same validation rule appears. There is a [Required]
on the model. A FluentValidation rule in the application layer. A required array in the OpenAPI
document. A conditional branch in the Blazor form. A JSON Schema consumed by the browser. A test that
repeats the boundary values one more time.

None of these copies is obviously wrong. Each one is locally reasonable. Together they form a
maintenance contract with no owner.

The problem is not that .NET lacks validation libraries. The problem is that validation is still
treated as a local implementation detail in every layer, so the rule changes shape as it travels.
A nullable annotation becomes a required array. A length range becomes a minLength and a
maxLength. A conditional rule becomes a comment in the client. A custom predicate becomes
"server-only" by accident.

Jeninnet.Validation begins with a different premise: a validation rule is a design artifact.
It deserves one declaration, one execution engine, and as many consumers as the system needs. The
rest of this article is about what that premise makes possible, where it stops, and how to decide
whether it fits your system.

The dependency rule applies to validation

Clean architecture is often described as a dependency rule: source-code dependencies point inward,
toward the domain. Frameworks are details. The database is a detail. The web is a detail.

Validation is usually exempted from that rule. It appears in the controller as model-state checks,
in the view as client-side hints, in the API document as a schema, and in the domain as an invariant.
The domain ends up depending on the web framework's validation attributes, or the web framework ends
up owning rules that only the domain can explain.

Jeninnet.Validation takes the dependency rule seriously. Jeninnet.Validation.Abstractions contains
contracts and value types and has no framework references. Jeninnet.Validation contains the engine
and the fluent API. Everything else — ASP.NET Core, Blazor, DataAnnotations, MediatR, GraphQL, gRPC,
OpenAPI, JSON Schema — is an optional adapter that points inward. The architecture test suite pins
that direction.

The practical consequence is simple: the same rule can run in a console application, a minimal API,
a MediatR handler, a Blazor form, and a gRPC service without being rewritten for each host.

namespace MyApp.Models;

using Jeninnet.Validation.Attributes;

[Validate]
public sealed class Customer
{
    [NotEmpty, Length(1, 100)]
    public string Name { get; init; } = string.Empty;

    [NotEmpty, Email]
    public string Email { get; init; } = string.Empty;

    [InclusiveBetween(18, 120)]
    public int Age { get; init; }
}
Enter fullscreen mode Exit fullscreen mode

The [Validate] attribute asks the Roslyn source generator to emit a CustomerValidator in
MyApp.Models.Validators. The generated type implements IValidator<Customer> and
IValidationDescriptorProvider. It is ordinary C#: readable, debuggable, and visible with
Go to Definition. There is no runtime expression-tree compilation and no hidden reflection step
on the validation path. Built-in rules cover presence, length, comparison, format (email, URL, IP,
Base64), date/time, collections, and cross-property conditions. The optional domain package adds
UUID, ULID, IBAN, VAT, postal code, national ID, and password policy. The rule reference lists the
complete set.

That last point is not a performance detail bolted onto the design. It changes what can be trusted.
If the validator is generated code, a debugger can step through it. If the metadata is a frozen
descriptor, a schema writer can consume it without executing the validator. The rule becomes an
artifact that other tools can inspect.

Two ways to write a rule, one engine

A framework that offers both attributes and a fluent API usually has a dirty secret: one path is
the real implementation, and the other is a convenience wrapper that behaves slightly differently.
Jeninnet.Validation refuses that split.

The attribute path is the declarative default. The fluent path is the supported alternative for
dynamic rules, closures over captured state, and validators that need constructor-injected services.

using Jeninnet.Validation;
using Jeninnet.Validation.Fluent;
using MyApp.Models;

public sealed class CustomerValidator : Validator<Customer>
{
    protected override void Configure(ValidatorRuleBuilder<Customer> builder)
    {
        builder.RuleFor(x => x.Name, nameof(Customer.Name))
               .NotEmpty()
               .Length(1, 100);

        builder.RuleFor(x => x.Email, nameof(Customer.Email))
               .NotEmpty()
               .EmailAddress();

        builder.RuleFor(x => x.Age, nameof(Customer.Age))
               .InclusiveBetween(18, 120);
    }
}
Enter fullscreen mode Exit fullscreen mode

Both paths implement the same IValidator<T> contract and feed the same execution engine. The
repository pins that claim with executable parity tests: the same model, the same scenarios, the same
expected results. This matters more than it first appears. Parity tests turn "these two APIs are
equivalent" from documentation into a build-time obligation.

The fluent path also carries the parts of validation that attributes cannot express well:

  • rules that depend on a service resolved from DI;
  • predicates that close over request state;
  • runtime rule sets selected by an authorization decision;
  • custom rules that need the model, the member value, and the validation context;
  • rule templates that are configured once and reused across validators.

Validators also compose. Include reuses another validator's rules at the root level;
IncludeBase composes a validator declared for a base type or interface; SetValidator reuses one
for a nested property; ChildRules defines nested rules inline. The generator walks base classes and
annotated interfaces for the attribute path, so inheritance is not a separate authoring model.

For the cases that fall between the two paths, a generated validator exposes a partial
AddCustomValidators() hook. The hook is deliberately narrow: it adds rules to the generated rule
lists, so the resulting validator still executes through the same engine and still appears in
Describe().

The compiler as the first test

A validation framework that only fails at runtime has moved the problem, not solved it.

The analyzer package ships 33 active VAL diagnostics and code fixes. They reject invalid rule
configurations before the application starts: a numeric rule applied to a string member, an open
generic model that would produce ambiguous generated names, a relative-date literal that cannot be
parsed invariantly, an inaccessible setter used by sanitization, a model shape that cannot be
generated deterministically.

The diagnostics are not decoration. They are the part of the framework that expresses a design
opinion: if the rule is wrong, the build should say so. The same principle explains why the source
generator emits readable code rather than a compressed blob. A developer who can read the generated
validator can reason about the rule; a developer who cannot is asked to trust the framework.

There is a trade-off here, and it is worth stating. Compile-time generation constrains the shape of
the model. Open generic models are rejected with VAL0022; a fluent validator is the escape hatch.
Models must declare a namespace; a model in the global namespace is not supported in this preview.
Those are real boundaries, not footnotes. The design chooses determinism over accepting every legal
C# shape.

The execution model is where validation frameworks usually leak

Most validation libraries handle the happy path well. The differences appear when a system needs to
answer questions such as:

  • Which rules run for this operation?
  • Do we stop at the first error or collect them all?
  • Does a failed member stop the rest of the model?
  • Can a rule depend on another rule's result?
  • Does an async rule run on the synchronous path?
  • What happens when a nested validator, a collection, and a rule set meet?
  • Can a caller select a subset of rules without rebuilding the validator?

Jeninnet.Validation treats these as first-class execution semantics, not configuration trivia.

Rule sets let a call select a named subset. When a call names sets, only those sets run; adding
default includes ungrouped rules. When RuleSets is null or empty, all rules run, including named
sets. Set names are case-insensitive, and exclusions win over inclusions. Per-call options and the
fluent ValidationStrategy builder expose the same controls; container-scoped options configure
property-name and display-name resolvers, a validator-factory fallback, and default cascade modes.

var result = validator.Validate(order, new ValidationCallOptions
{
    RuleSets = ["strict"],
    CascadeMode = CascadeMode.Stop,
    FailFast = true
});
Enter fullscreen mode Exit fullscreen mode

Cascade modes control what happens inside a member. Continue evaluates every rule; Stop skips
the remaining rules for that member after the first failure. Class-level cascade stops after the
first failed member while preserving the rule-level behavior inside it. Fail-fast stops at the
first error across the whole walk.

The distinction between fail-fast and throw-on-failure is deliberate. Fail-fast controls collection.
ThrowOnFailures controls delivery: the result is still collected, failure hooks still run, and the
final ValidationException carries every error that survived collection. Conflating the two is a
common source of surprising behavior in validation pipelines.

Conditions and dependent rules gate execution without forcing every validator to reimplement the
same if statements. Include/exclude filters and custom selectors narrow the rule set after rule
sets and property filters have run. The default path stays allocation-free; only filtered paths
materialize a new rule array.

Collections and nesting are where path semantics usually become inconsistent. Jeninnet uses
bracket paths such as Lines[0].Quantity, supports collection count rules, ForEach with a child
validator, ForEachElement when null elements must be validated, and Where filters on collection
rules. CollectionIndex is available as a message parameter, and OverrideIndexer changes the
displayed path segment. SetValidator prefixes nested errors with the parent path; ChildRules is
the inline equivalent; SetInheritanceValidator dispatches on the exact runtime type.

Async is a contract, not a convention. A validator with async rules but no sync rules throws
AsyncValidatorInvokedSynchronouslyException on the synchronous path. It does not silently skip the
async rule. That choice is less convenient in the short term and more truthful in the long term:
a validation result that claims success because a rule was skipped is worse than an exception that
names the problem.

Lifecycle hooks are part of the rule model. PreValidate/PreValidateAsync can stop evaluation
before rules run; OnFailure/OnFailureAsync run after collection. Declarative hooks are static and
synchronous; fluent hooks cover the asynchronous and service-dependent cases. Hook errors merge with
rule errors, but a false pre-validation result always stops rule evaluation.

Sanitization is explicit preprocessing. Sanitize and [Sanitize] trim, normalize case, and
remove control characters before rules run. Sanitization mutates the model in place, so it is never
silent: the model's contract says it happens. Only string and IList<string> members are supported,
there are no asynchronous sanitizers, and inaccessible setters are rejected at build time with
VAL0027.

None of these semantics is novel in isolation. The design claim is that they compose through one
engine, so a generated validator and a fluent validator answer the same questions the same way.

Descriptors: the rule survives the trip

The most useful idea in the framework is not the fluent API or the source generator. It is the
descriptor.

Fluent and generated validators implement IValidationDescriptorProvider. Describe() returns a
frozen descriptor containing members, rule kinds, message keys, severities, conditions, and rule
parameters. The descriptor is not a log of what happened. It is a description of what the validator
knows. Runtime errors carry the same vocabulary: MemberName, MessageKey, MessageParameters,
ErrorCode, Severity, and CustomState.

That distinction is what makes the "many surfaces" part real. JSON Schema (draft 2020-12, deterministic
and AOT-safe), OpenAPI, and client-rule packages consume descriptors. They never execute validation.
They do not maintain a parallel list of rules. They project the same rule model into a different
format.

Two authoring paths, one engine, many projections

Attributes and the fluent API converge on one engine; schemas and client rules are projections of
the same descriptor.

using Jeninnet.Validation.JsonSchema;
using Jeninnet.Validation.ClientRules;

var descriptor = new CreateOrderValidator().Describe();

var jsonSchema = ValidationSchemaWriter.WriteToString(descriptor);
var clientRules = ClientRulesWriter.WriteToString([new CreateOrderValidator()]);
Enter fullscreen mode Exit fullscreen mode

A few examples show the projection:

Rule JSON Schema projection
NotNull, NotEmpty required; NotEmpty also sets minLength: 1 or minItems: 1 when the type is known
Length(min, max) minLength / maxLength
EmailAddress() format: "email"
InclusiveBetween(min, max) minimum / maximum
ForEach type: array, items, and a $ref to the element schema
Must, Custom, conditional rules advisory x-validation-rules entries; conditions are marked hasCondition

The projection is honest about its limits. required is a presence constraint; it does not express
"non-zero" for an int. Conditional rules are exported as advisory because a delegate is not a
portable schema expression. Custom rules remain advisory unless they expose metadata. The server
remains the authority.

OpenAPI support is split into three adapters because .NET teams do not agree on one OpenAPI
generator: Jeninnet.Validation.OpenApi for Microsoft.AspNetCore.OpenApi,
Jeninnet.Validation.OpenApi.Swashbuckle, and Jeninnet.Validation.OpenApi.NSwag. All three read the
same ValidationSchemaRegistry, so the constraints match the JSON Schema and client-rule emitters.
They resolve member names through the active JsonSerializerOptions and JsonTypeInfo, including
[JsonPropertyName]. All three add only the constraints the validator declares; the Swashbuckle and
NSwag adapters also preserve an existing schema type.

Client rules are exported as JSON, TypeScript, or JavaScript. The companion
@jeninnet/validation-client ESM runtime evaluates the supported synchronous subset. Nested rules
are composed when the child validator exposes a descriptor. When a rule is conditional, custom,
asynchronous, or otherwise not portable, the payload marks it serverOnly: true and the result
exposes needsServer. That is the correct design: the client gets early feedback, not a second
authoritative engine.

Integrations are adapters, not the center

A framework that claims to be modular is usually judged by how much it forces into the center.
Jeninnet.Validation keeps the center small: Abstractions and the engine. Every host integration is a
separate package with an explicit lifetime and an explicit failure mode.

Surface Package What it does
Minimal APIs and MVC Jeninnet.Validation.AspNetCore Request validation filters, interceptors, ProblemDetails, exception handling
Microsoft.Extensions.Validation Jeninnet.Validation.Extensions.Validation IValidatableTypeInfo/IValidatableParameterInfo on .NET 11; options validation
DataAnnotations Jeninnet.Validation.DataAnnotations Runs validators in existing DataAnnotations pipelines
Blazor Jeninnet.Validation.Blazor EditContext adapter, async submit, static SSR data-val-* rendering
Desktop/MAUI/Avalonia Jeninnet.Validation.Observable INotifyDataErrorInfo decorator for view models
MediatR Jeninnet.Validation.MediatR Aggregated request validation before handlers
MediatR results Jeninnet.Validation.MediatR.ErrorOr, .FluentResults, .CSharpFunctionalExtensions Optional result adapters; ErrorOr and FluentResults preserve validation metadata, CSharpFunctionalExtensions preserves the message
GraphQL Jeninnet.Validation.GraphQL HotChocolate field middleware for input objects
gRPC Jeninnet.Validation.Grpc Unary and server-streaming interceptor with InvalidArgument and BadRequest details
Diagnostics Jeninnet.Validation.Diagnostics OpenTelemetry-compatible ActivitySource and Meter signals

The adapter boundary is not cosmetic. Core and Abstractions have no ASP.NET Core, MediatR, Blazor,
GraphQL, or gRPC references. The architecture suite pins that. A console application pays for none
of the web stack. A Blazor application pays for the Blazor adapter only when it uses it.

The failure modes are explicit, too. ASP.NET Core and Blazor bypass validation when no validator is
registered; DataAnnotations throws when it cannot construct one; MediatR result adapters are separate
packages because the core pipeline should not depend on ErrorOr, FluentResults, or
CSharpFunctionalExtensions. Those are small decisions individually. Together they keep the dependency
graph readable.

Localization is not string replacement

Most validation libraries treat localization as a dictionary lookup. That works until a message needs
a plural, a select, a property name, a boundary value, or a culture fallback that is not English.

Jeninnet.Validation.Localization ships message packs for 40 cultures and covers every
ValidationMessageKeys constant. The pipeline supports ICU plural and select messages, named
placeholders such as {PropertyName}, {Min}, {Max}, {CollectionIndex}, and {PropertyValue},
and culture names that preserve script and region subtags (pt-BR, zh-Hans). The optional
Jeninnet.Validation.Localization.AspNetCore package adds an IStringLocalizer/RESX bridge with
explicit culture control and a documented resolution order.

using Jeninnet.Localization.Abstractions.Options;
using Jeninnet.Validation.Localization;

services.AddSingleton(new LocalizationOptions { DefaultCulture = "en" });
services.AddDefaultMessagePacks();
Enter fullscreen mode Exit fullscreen mode
using System.Globalization;

var localizer = provider.GetRequiredService<IMessageLocalizer>();

foreach (var error in result.Errors)
{
    var message = await localizer.LocalizeValidationErrorAsync(
        error,
        new CultureInfo("ar"));
}
Enter fullscreen mode Exit fullscreen mode

The design keeps two rules visible. First, the platform enforces exactly one
IInnerMessageProvider; adding a second provider is an error, not a silent precedence puzzle.
Second, the runtime catalog is process-local and in-memory. If a system needs persistent or
multi-instance messages, it registers an ILocalizationStore and uses the sibling
Jeninnet.Localization platform, which supports JSON, XML, RESX, memory, and database-backed
sources. That is a deployment decision, not something the validation engine should hide.

The built-in non-English packs are machine-assisted drafts and are explicitly tracked for
native-speaker review before the stable release. Saying so is part of the design: a localization
feature that ships unverified text without a review path is a liability, not a feature.

The rule model has a lifecycle

A framework is not only the code that runs in production. It is also the tests that describe the
rule, the tooling that moves an existing codebase onto it, and the signals that tell an operator
whether it is working.

Jeninnet.Validation.Assertions is the test-time package. It provides assertions such as
ShouldHaveValidationErrors().ForMember(...).ContainsRule(...), so a test can name the rule that
should have failed rather than assert on a message string. The same package exposes TestValidate
helpers for fluent and generated validators. This is a small package with a large effect: it keeps
the test suite coupled to the rule model, not to a particular error rendering.

Jeninnet.Validation.Migration is the adoption tool. It scans C# sources for FluentValidation and
DataAnnotations patterns, reports what converts cleanly, and applies safe, idempotent codemods.
Anything it does not understand is left untouched with an explicit // TODO(Jeninnet): marker and a
report entry. The report includes a migration readiness score and the files that are fully
convertible. It can run as a CI gate so old validation code cannot quietly reappear.

dotnet tool install --global Jeninnet.Validation.Migration --version 1.0.0-preview.1

jeninnet migrate analyze ./src --format markdown --output migration-report.md
jeninnet migrate apply ./src --dry-run
jeninnet migrate apply ./src
Enter fullscreen mode Exit fullscreen mode

Jeninnet.Validation.Diagnostics adds OpenTelemetry-compatible ActivitySource and Meter signals
for validation duration and error counts. Messages, property values, and custom state never reach
tags. With no sink installed, the core pays one null check; with a sink installed, the host decides
what to sample and where to export. That is the right boundary: observability is a host concern, not
a reason for the validation engine to know about a telemetry vendor.

Jeninnet.Validation.Rules.Domain adds optional structural rules for IBAN, VAT numbers, postal
codes, national identifiers, password strength, UUID, and ULID. They are offline and explicit about
their supported countries. They validate shape and checksums; they do not prove that an account,
company, or person exists.

Performance and AOT are constraints on the design

Performance claims are easy to make and hard to keep honest. Jeninnet.Validation makes three
specific claims, each with a test or a benchmark behind it.

No reflection on the validation path. Generated validators are compiled C#. The fluent path uses
typed accessors. Reflection-based assembly scanning exists, but it is annotated with
[RequiresUnreferencedCode] and has an explicit-registration alternative. The NativeAOT smoke
harness publishes and runs the engine, generator, localization, and source-generated JSON in CI.

Zero allocations on the valid path. The ValidationErrorCollector and RootContextData are
pooled per thread. Rule selection returns the original rule array when no filters apply.
ValidationResult.FromErrors snapshots the errors before the collector returns to the pool. The
audit records 0 B/op for 5, 10, and 30 validated properties, and 0 B/op for localization lookups and
the Base64 rule. Error paths allocate the errors themselves, as they must: 968 B for five errors,
2,104 B for ten, 6,024 B for thirty. Fail-fast reduces both time and allocation.

The numbers are directional, not universal. On the repository machine, the peer benchmark
measured 81.7 ns / 0 B for Jeninnet versus 226.7 ns / 632 B for FluentValidation on the valid path.
Those numbers are useful as a baseline. They are not a promise about your hardware, your model, or
your error rate. Run the benchmark harness before making a capacity decision.

The same discipline applies to correctness. The suite contains 997 tests on net11.0. Capability
parity covers 93/93 of the .NET 10 peer-capability union and 93/95 on the full matrix; the two
remaining rows are the .NET 11 async DataAnnotations and async Options bridges deferred to
1.1.0-preview.1. The repository ships 26 sample projects, including Clean Architecture and
XML-localization samples. The SonarCloud quality gate reports 80.2% coverage, 0.0% duplicated lines,
and 0 open issues; the AOT/trimming analyzers are clean.

Package validation runs with EnablePackageValidation=true. A package-content check verifies README,
license, icon, XML documentation, analyzer layout, and the expected lib/net11.0 assets. A consumer
smoke test installs the packed packages from a local feed and validates a model. Documentation claims
are checked against the repository. These are not marketing checks. They are the mechanism that keeps
a framework with 25 packages from becoming 25 unrelated projects.

The capability map

The package map answers "what do I install?" The capability map answers "what does the preview
actually cover?" Both matter when the decision is architectural rather than tactical.

Concern What the preview provides
Authoring Attributes and source generation, the fluent API, executable parity tests, 33 active VAL diagnostics, custom rules and templates, inheritance, collections and nesting, explicit sanitization
Execution Rule sets, cascade modes, fail-fast, throw-on-failure, conditions, dependent rules, include/exclude filters, custom selectors, lifecycle hooks, strict async contract, per-call options
Metadata Frozen descriptors; JSON Schema draft 2020-12; OpenAPI adapters for Microsoft.AspNetCore.OpenApi, Swashbuckle, and NSwag; client rules as JSON, TypeScript, and JavaScript
Hosts ASP.NET Core, Microsoft.Extensions.Validation, DataAnnotations, Blazor, Observable UI, MediatR with three result adapters, GraphQL, gRPC, and OpenTelemetry diagnostics
Localization 40 cultures, ICU plural/select, named placeholders, RESX bridge, runtime catalog, and multi-source stores through Jeninnet.Localization
Operations Domain rules, test assertions, migration assistant, package validation, consumer smoke test, NativeAOT smoke harness
Assurance 997 tests, 93/93 .NET 10 peer-capability parity, 0 B/op valid path, documentation claim checks

The 25-package map

A package boundary is a design decision, not a feature toggle. The preview ships 25 packages because
the framework has 25 distinct reasons to take a dependency.

Area Packages
Core Jeninnet.Validation, Jeninnet.Validation.Abstractions, Jeninnet.Validation.Analyzers
Localization Jeninnet.Validation.Localization, Jeninnet.Validation.Localization.AspNetCore
Web and UI Jeninnet.Validation.AspNetCore, Jeninnet.Validation.Extensions.Validation, Jeninnet.Validation.DataAnnotations, Jeninnet.Validation.Blazor, Jeninnet.Validation.Observable
Messaging Jeninnet.Validation.MediatR, Jeninnet.Validation.MediatR.ErrorOr, Jeninnet.Validation.MediatR.FluentResults, Jeninnet.Validation.MediatR.CSharpFunctionalExtensions
Remote APIs Jeninnet.Validation.GraphQL, Jeninnet.Validation.Grpc
Metadata and clients Jeninnet.Validation.JsonSchema, Jeninnet.Validation.OpenApi, Jeninnet.Validation.OpenApi.Swashbuckle, Jeninnet.Validation.OpenApi.NSwag, Jeninnet.Validation.ClientRules
Domain and operations Jeninnet.Validation.Rules.Domain, Jeninnet.Validation.Diagnostics, Jeninnet.Validation.Assertions, Jeninnet.Validation.Migration

The intended adoption path is deliberately narrow. Start with Jeninnet.Validation and
Jeninnet.Validation.Analyzers. Add one host adapter when the host needs it. Add the metadata
packages when the system already publishes a schema or a client. Do not adopt the whole map on the
first day; the package map is a menu, not a checklist.

What this preview does not do

A framework that only describes its strengths is asking to be trusted rather than evaluated. These
are the boundaries to weigh before adopting the preview.

  • net11.0 only. Every shipping library targets net11.0; the analyzer targets netstandard2.0. The DataAnnotations and Extensions.Validation bridges ship lib/net11.0 assets. The solution uses C# 15. This is an STS-first release, not a multi-target compatibility play.
  • Async DataAnnotations and async Options are deferred. The synchronous bridges ship now; the .NET 11 async versions are planned for 1.1.0-preview.1.
  • Some UI and legacy bridges are synchronous. DataAnnotations and the default Blazor/Observable paths are synchronous; async-only rules throw on those paths. Use the ASP.NET Core, Minimal API, MediatR, or explicit Blazor async submit path for async rules.
  • Models must declare a namespace. The generator emits validators under <model namespace>.Validators; a model in the global namespace is not supported in this preview.
  • Built-in rules are sealed. Sealing keeps the hot path devirtualizable and the metadata truthful. Extend through Custom/CustomAsync, RuleTemplate, SyncValidateRule/AsyncValidateRule, or the rule interfaces.
  • Schema and client output are projections. Conditional, custom, and asynchronous rules may be marked server-only; nested rules are composed when the child validator exposes a descriptor. The server remains authoritative.
  • Domain rules are structural. IBAN, VAT, postal-code, and national-ID rules validate shape and checksums; they do not prove that an account, company, or person exists.
  • Localization drafts need review. The 40 packs are machine-assisted drafts; native-speaker review is tracked before the stable release.
  • This is a preview. The public surface is documented and baselined, but the compatibility policy is a preview policy, not a stable-release guarantee.

None of these limits invalidates the design. They define the scope in which the design can be
evaluated.

Try it on one boundary

The fastest way to evaluate a validation framework is not to migrate a solution. It is to pick one
boundary where the rule currently exists twice, and delete one copy.

dotnet add package Jeninnet.Validation --version 1.0.0-preview.1
dotnet add package Jeninnet.Validation.Analyzers --version 1.0.0-preview.1
Enter fullscreen mode Exit fullscreen mode
using Jeninnet.Validation.Abstractions;
using Jeninnet.Validation.Catalog;
using Microsoft.Extensions.DependencyInjection;
using MyApp.Models;

var services = new ServiceCollection();
services.AddValidation();

using var provider = services.BuildServiceProvider();
var validator = provider.GetRequiredService<IValidator<Customer>>();
var result = validator.Validate(new Customer { Name = "", Email = "bad", Age = 10 });

foreach (var error in result.Errors)
{
    Console.WriteLine($"{error.MemberName}: {error.Message ?? error.MessageKey}");
}
Enter fullscreen mode Exit fullscreen mode

A focused trial looks like this:

  1. Add the core package and the analyzer to one project.
  2. Annotate one model. Run the build and read the generated validator.
  3. Validate that model in one endpoint or one handler. Keep the existing tests.
  4. Call Describe() and compare the JSON Schema or client-rule output with the contract you already publish. If they disagree, you have found either a migration task or a real inconsistency.
  5. Add one integration package only after the first four steps pass.

The order matters. Starting with the metadata packages gives you a schema without an execution
engine. Starting with the UI adapter gives you a form without a domain contract. Starting with the
core and one boundary gives you evidence.

The rule should survive the trip

The interesting question is not whether a validation library can validate a string. Most can. The
interesting question is whether a rule can survive the trip from the domain to the API contract, the
client, and the test suite without becoming a different rule.

That is the problem this preview is built to make visible. One rule, one engine, many surfaces is not
a slogan about package count. It is a constraint on where validation knowledge is allowed to live.

If that constraint matches a problem you recognize, the preview is ready for a focused trial. If your
system is entirely synchronous, single-surface, and unlikely to publish a schema or a client, a
smaller library may be the better engineering choice. The framework is designed to make that
judgment easier, not to make it for you.

If you try the preview, the most useful feedback is a boundary case: a model shape, a rule
composition, or a host integration that did not fit. Open an issue with the smallest reproduction you
can share.

Links

Top comments (0)