Skip to content
From 0.5.0 the packages continue as @cqrs-ddd, documented at aristoteliss.github.io/ddd-cqrs; NestJS applications add @cqrs-ddd/nestjs. This site documents the 0.4.x line.

NumberRuleOptions

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

Options of numberRule.

readonly optional error?: ValueViolationError

Defined in: packages/ddd-core/domain/rules/number.rule.ts:28

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


readonly field: string

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

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


readonly optional integer?: boolean

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

true accepts safe integers only (Number.isSafeInteger), so the value survives a round trip through JSON and a bigint column.


readonly optional max?: number

Defined in: packages/ddd-core/domain/rules/number.rule.ts:23

Largest accepted value, inclusive.


readonly optional min?: number

Defined in: packages/ddd-core/domain/rules/number.rule.ts:21

Smallest accepted value, inclusive.


readonly optional required?: boolean

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

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