Skip to content

Documentation / @facturometro/core / createIssue

Function: createIssue() ​

createIssue(input): Issue

Defined in: packages/core/src/issue.ts:218

Builds an Issue, filling in what can be derived from the rest.

pathString is rendered from path and docsUrl is resolved from the rule id, both only when the caller did not supply them. Rule ids without an upstream documentation page (custom rules, this library's own EINV-* diagnostics) simply get no docsUrl.

Parameters ​

input ​

IssueInput

The issue, without the fields that can be derived.

Returns ​

Issue

The complete issue. The input is not mutated.

Example ​

ts
import { createIssue } from '@facturometro/core';

const issue = createIssue({
  id: 'BR-CO-10',
  message: 'Sum of Invoice line net amount must equal the sum of the line amounts.',
  path: ['legalMonetaryTotal', 'lineExtensionAmount'],
  severity: 'fatal',
  source: 'rule',
  xpath: '/Invoice/cac:LegalMonetaryTotal/cbc:LineExtensionAmount',
});
issue.pathString; // 'legalMonetaryTotal.lineExtensionAmount'

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