Documentation / @facturometro/einvoice / 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 ​
The issue, without the fields that can be derived.
Returns ​
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'