Documentation
Table of Contents

Class IntentRules

Namespace
IntentSharp.Catalog
Assembly
IntentSharp.Catalog.dll

Declarative checks evaluated on the result rendered as JSON (typed results are serialized first, so the same rules work for compiled and runtime shapes). Every violated rule becomes a validator issue fed back to the model.

public sealed class IntentRules
Inheritance
object
IntentRules
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Extension Methods

Remarks

A null value passes every rule except NotEmpty; a property that must be present and not null belongs in Required. Bounds are inclusive, and an unset rule is not checked. For text and primitive shapes, a rule that does not apply to the result (for example Minimum on text) is refused when the definition is checked; for other shapes, a rule that meets a value of the wrong kind is reported as a violation that names the rule.

Constructors

IntentRules()

Creates rules that check nothing; each rule is checked only once it is set.

Properties

Enum

Allowed values (compared as strings, case-insensitive for strings).

Items

Rules applied to every array element.

MaxItems

The most items allowed, 0 or more. Applies to lists.

MaxLength

The most characters allowed, counted as Unicode code points, 0 or more. Applies to text.

Maximum

The largest number allowed. Applies to numbers.

MinItems

The fewest items allowed, 0 or more. Applies to lists.

MinLength

The fewest characters allowed, counted as Unicode code points, 0 or more. Applies to text.

Minimum

The smallest number allowed. Applies to numbers.

NotEmpty

Strings, arrays and objects must not be empty.

Pattern

A .NET regular expression the text must match. It may match anywhere in the text, so anchor it with ^ and $ to match the whole value; each match runs with a time limit. Applies to text.

Properties

Rules per object property (by JSON property name).

Required

Object properties that must be present and non-null.

UniqueItems

True requires every item in the list to be different from the others. Applies to lists.