Class IntentValidatorRegistry
- Namespace
- IntentSharp.Catalog
- Assembly
- IntentSharp.Catalog.dll
Code validators that definitions reference by name in validators, for checks rules cannot express (a lookup, a
checksum, a cross-field invariant). A validator receives the parsed result (the .NET value, or a JsonNode for
schema shapes) and returns one message per problem; the messages are fed back to the model. Names ignore case.
Safe to use from several threads; validators added later apply to the next run.
public sealed class IntentValidatorRegistry : IIntentValidatorRegistry
- Inheritance
-
objectIntentValidatorRegistry
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Constructors
- IntentValidatorRegistry()
Creates an empty registry with no validators.
Properties
- Names
The registered names, trimmed. Each read returns a new copy, so later registrations do not change it.
Methods
- Add(string, Func<object?, IEnumerable<string>>)
Registers a validator. Throws when the name is already registered.
- Add<T>(string, Func<T, IEnumerable<string>>)
Registers a typed validator. A value of another type is reported as a problem rather than passed in.
- TryGet(string, out Func<object?, IEnumerable<string>>)
Finds the validator registered as
name, ignoring case and surrounding white space. Returns false, withvalidatornull, for a null or unregistered name.