Skip to content

v0.0.15

Latest

Choose a tag to compare

@ryukzak ryukzak released this 03 Jun 09:36
· 18 commits to main since this release

This release focuses on TypeScript profile correctness — generated validate() methods and choice setters now match what a FHIR server accepts, closing several gaps where invalid resources passed client-side validation only to be rejected at write time.

Highlights (TypeScript profiles)

  • Inherited required fields are now validated. Profile snapshots silently dropped any base-resource cardinality the profile differential didn't re-state, so validate() skipped inherited required fields (e.g. Provenance.target, Provenance.recorded). These now emit validateRequired() calls. — by @sussdorff in #166

  • choice[x] mutual exclusion is enforced in setters. A polymorphic value[x] permits at most one variant, but setters assigned independently — populating two left both set and serialized invalid FHIR. Setters now clear sibling variants, and a public clearValue() / clearEffective() helper lets you drop a choice entirely. — by @ryukzak in #172

    // before — both survive (invalid)
    obs.setValueQuantity({ value: 120, unit: "mmHg" });
    obs.setValueCodeableConcept({ text: "unable to obtain" });
    // => { valueQuantity: {...}, valueCodeableConcept: {...} }
    
    // after — setting one clears the others
    // => { valueCodeableConcept: {...} }
    obs.clearValue(); // or drop it explicitly
  • Fixed CodeableConcept codings are preserved. apply() now merges fixed values instead of replacing them, so caller-provided secondary codings survive while missing fixed codings are added. — by @sussdorff in #165

Fixes

  • Skip base choice[x] declarations when collecting inherited required fields — previously emitted a validateRequired(res, profile, "value[x]") check against a key that never exists in FHIR JSON. — by @ryukzak in #170
  • Placeholder-only ValueSet expansions (e.g. a sole UNK code) no longer generate enum validation constraints. — by @sussdorff in #165
  • Profiles that relax a base field to min: 0 no longer emit a spurious required check. — by @sussdorff in #166

Internal

  • Introduce SnapshotProfileTypeSchema — a writer-ready profile shape that moves profile method derivation out of the TS writer into TypeSchema (output byte-identical seam for upcoming work). — by @ryukzak in #158
  • Fix test-fixture pollution causing platform-dependent snapshot failures. — by @sussdorff in #155

Examples & CI

  • Align the typescript-us-core example with the tutorial and demo Bundle<T>. — by @ryukzak in #157
  • Add an example demo for inherited base-required field validation. — by @ryukzak in #171
  • Bump Node to 22 for the package-managers CI job. — by @ryukzak in #156

Contributors

@sussdorff, @ryukzak

Full Changelog: v0.0.14...v0.0.15