Skip to main content
Version: v0.0.4

Function: validateProfileQuirks()

validateProfileQuirks(profile, registry, format): readonly string[]

Validate the quirk names carried by a SynthProfile against a format's registry, failing closed on the first unsupported one. Lets a consumer author a fixture recipe with defineSynthProfile and have its quirks checked against the parser's real tolerance before any fixture is generated.

Parameters

profile

SynthProfile

The synth profile whose quirks to validate.

registry

Readonly<Record<string, QuirkDescriptor>>

The format's quirk descriptors.

format

SynthFormat

The format being generated.

Returns

readonly string[]

The validated quirk names (the profile's, in order).

Throws

SynthError SYNTH_UNSUPPORTED_QUIRK for the first unsupported quirk.

Example

import { validateProfileQuirks, defineSynthProfile } from "@cosyte/synth";
import { HL7_QUIRKS } from "@cosyte/synth/hl7";
const p = defineSynthProfile({ name: "site", quirks: ["unknown-zsegment"] });
validateProfileQuirks(p, HL7_QUIRKS, "hl7v2"); // ["unknown-zsegment"]