Class GuardrailServiceCollectionExtensions
- Namespace
- IntentSharp.Guardrails
- Assembly
- IntentSharp.Guardrails.dll
Registers guardrail rule files for the IntentClient that AddIntentSharp builds:
services.AddDocumentStore("policy"); // the store the client keeps its documents in
services.AddGuardrails(store, "orders-data"); // the rule files that store's manifest lists
services.AddIntentSharp(configuration);
The client reads the registered source, options, kinds, format and validator when it is built, so it checks the
rule files' sets and validates every edit of them. Rules a rule file writes as intent compile only when
AddRuleCompilation(IServiceCollection, Action<RuleCompileOptions>?) is called too (experimental, INTENTSHARP001).
public static class GuardrailServiceCollectionExtensions
- Inheritance
-
objectGuardrailServiceCollectionExtensions
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()object.ReferenceEquals(object, object)object.ToString()
Methods
- AddGuardrails(IServiceCollection, IDocumentStore, Action<GuardrailSourceOptions>, params string[])
Registers the rule files
storeholds as the client's guardrails: a DocumentGuardrailSource as the IGuardrailSource, GuardrailOptions withsetsas the default sets, the YAML format, the RuleDocumentValidator and the built-inschemakind. The source and the validator know the kinds, subjects and settings declared inconfigureand those registered in the container (IGuardrailKind, SubjectDescriptor, SettingDescriptor), and the client's options carry the ones declared inconfigureand its CodeSettings as their CodeSettings. The validator compares a raisedclient.*limit that no running version sets with the IntentClientOptions valueAddIntentSharpgives the client when the code settings do not set it. A source or options registered before this call are kept: the first registration wins.
- AddGuardrails(IServiceCollection, IDocumentStore, params string[])
Registers the rule files
storeholds as the client's guardrails, withsetsas the sets the client applies when a check names none. See AddGuardrails(IServiceCollection, IDocumentStore, Action<GuardrailSourceOptions>, params string[]).