Documentation
Table of Contents

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
object
GuardrailServiceCollectionExtensions
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 store holds as the client's guardrails: a DocumentGuardrailSource as the IGuardrailSource, GuardrailOptions with sets as the default sets, the YAML format, the RuleDocumentValidator and the built-in schema kind. The source and the validator know the kinds, subjects and settings declared in configure and those registered in the container (IGuardrailKind, SubjectDescriptor, SettingDescriptor), and the client's options carry the ones declared in configure and its CodeSettings as their CodeSettings. The validator compares a raised client.* limit that no running version sets with the IntentClientOptions value AddIntentSharp gives 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 store holds as the client's guardrails, with sets as the sets the client applies when a check names none. See AddGuardrails(IServiceCollection, IDocumentStore, Action<GuardrailSourceOptions>, params string[]).