Skip to content

Documentation / @facturometro/validator / resolveDocumentRuleset

Function: resolveDocumentRuleset() ​

resolveDocumentRuleset(document, options?): RulesetComposition

Defined in: packages/validator/src/engine/validate.ts:219

The composition validate runs for a document: the ruleset option when it is given, otherwise the one the registry resolves from normalize-space(cbc:CustomizationID) (see resolveRuleset()). A caller that needs the composition next to the result - the umbrella's validateXml() applies its structural configuration to parser diagnostics - resolves it here and passes it as ruleset, so both use the same one.

Parameters ​

document ​

Document | UncheckedDocument

A parsed or built document.

options? ​

Pick<ValidateOptions, "ruleset"> = {}

The ruleset option, if any.

Returns ​

RulesetComposition

The composition.

Example ​

ts
import { resolveDocumentRuleset, validate } from '@facturometro/validator';

const ruleset = resolveDocumentRuleset(parsed.document);
ruleset.map((constant) => constant.id); // ['en16931', 'peppol'] for a Peppol invoice
validate(parsed.document, { ruleset });

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.