Skip to content

TextRuleOptions

Defined in: packages/ddd-core/domain/rules/text.rule.ts:7

Options of textRule.

readonly optional error?: ValueViolationError

Defined in: packages/ddd-core/domain/rules/text.rule.ts:40

Builds the error thrown for a violation. Defaults to InvalidValueException.


readonly field: string

Defined in: packages/ddd-core/domain/rules/text.rule.ts:9

Field name reported in the violation and in the default message.


readonly optional maxLength?: number

Defined in: packages/ddd-core/domain/rules/text.rule.ts:25

Most characters after normalization, counted like minLength. A column limit counted in code points, such as varchar(n), is never exceeded by a value within it.


readonly optional minLength?: number

Defined in: packages/ddd-core/domain/rules/text.rule.ts:19

Fewest characters after normalization, counted in UTF-16 code units like String.length and Zod’s .min().


readonly optional multiline?: boolean

Defined in: packages/ddd-core/domain/rules/text.rule.ts:35

true accepts tab, line feed and carriage return inside the text. Defaults to false: they are a characters violation.


readonly optional pattern?: RegExp

Defined in: packages/ddd-core/domain/rules/text.rule.ts:30

Pattern the normalized text must match. A g or y flag is rejected, because test() would then depend on the previous call.


readonly optional required?: boolean

Defined in: packages/ddd-core/domain/rules/text.rule.ts:14

false accepts null, undefined and blank text, and normalizes them to null. Defaults to true: they are a required violation.