Skip to main content
Version: v0.0.2

Function: missingRequiredLoop()

missingRequiredLoop(position, loopId, rationale): X12ParseWarning

Build an X12_MISSING_REQUIRED_LOOP warning. Emitted when a TR3-required loop is structurally absent (e.g. no Loop 2010BB Payer Name inside a Subscriber HL). The parser does not enforce situational rules - only loops marked usage: "required" in the loop spec fire this warning. The loop id is shape-validated before echoing.

Parameters

position

X12Position

loopId

string

rationale

string

Returns

X12ParseWarning

Example

import { missingRequiredLoop } from "@cosyte/x12";
const w = missingRequiredLoop(
{ segmentIndex: 12, interchangeIndex: 0, groupIndex: 0, transactionIndex: 0 },
"2010BB",
"Loop 2010BB Payer Name required when Loop 2000B (Subscriber HL) is present",
);