Skip to content

Documentation / @einvoice-ts/validator / Ruleset

Interface: Ruleset ​

Defined in: packages/validator/src/rulesets/define.ts:118

A ruleset constant: the frozen definition, with defaults filled in. Compose constants in a list to validate against them.

Example ​

ts
import { dkRuleset, en16931Ruleset, peppolRuleset, validate } from '@einvoice-ts/validator';

validate(invoice, { ruleset: [en16931Ruleset, peppolRuleset, dkRuleset] });
dkRuleset.requires.map((ruleset) => ruleset.id); // ['peppol']

Properties ​

disable ​

readonly disable: readonly string[]

Defined in: packages/validator/src/rulesets/define.ts:120

Rule ids or globs to remove from what earlier constants defined.


id ​

readonly id: string

Defined in: packages/validator/src/rulesets/define.ts:122

Ruleset id.


normalize? ​

readonly optional normalize?: Normalizer

Defined in: packages/validator/src/rulesets/define.ts:124

Defaults hook, when the ruleset has one.


override ​

readonly override: Readonly<Record<string, RuleOverride>>

Defined in: packages/validator/src/rulesets/define.ts:126

Patches to rules earlier constants defined, by id.


requires ​

readonly requires: readonly Ruleset[]

Defined in: packages/validator/src/rulesets/define.ts:128

Rulesets that must appear earlier in every list this one is in.


rules ​

readonly rules: readonly Rule<unknown>[]

Defined in: packages/validator/src/rulesets/define.ts:130

The rules.


spec ​

readonly spec: Readonly<Record<string, string>>

Defined in: packages/validator/src/rulesets/define.ts:132

The specification versions the ruleset implements.


version ​

readonly version: string

Defined in: packages/validator/src/rulesets/define.ts:134

Ruleset version.


when? ​

readonly optional when?: (ctx) => boolean

Defined in: packages/validator/src/rulesets/define.ts:141

Document-level gate of every rule of the ruleset, when it has one.

Parameters ​

ctx ​

RuleContext

The rule context.

Returns ​

boolean

Whether the ruleset applies to the document.

MIT licensed. Specification material belongs to OpenPeppol, CEN and OASIS (see NOTICE). Peppol is a trademark of OpenPeppol AISBL; this project is not affiliated with it.