The generated validate() method checks slice cardinality (e.g. systolic and diastolic slices exist) but does not validate required fields within slice elements.
Example
The BP profile requires component.valueQuantity (min: 1) for both systolic and diastolic slices. After create(), auto-populated stubs have only the discriminator code but no valueQuantity:
const profile = bpProfile.create({
status: "final",
subject: { reference: "Patient/pt-1" },
});
// Only reports missing effective[x], but should also report
// missing valueQuantity in systolic and diastolic component stubs
profile.validate().errors
// Actual: ["at least one of effectiveDateTime, effectivePeriod is required"]
// Expected: should also include errors about missing component.valueQuantity
Scope
- Affects
src/api/writer-generator/typescript/profile-validation.ts
- Needs to iterate slice elements and check required fields within each matched slice
- Applies to all profiles with required fields inside slices (BP components, etc.)
The generated
validate()method checks slice cardinality (e.g. systolic and diastolic slices exist) but does not validate required fields within slice elements.Example
The BP profile requires
component.valueQuantity(min: 1) for both systolic and diastolic slices. Aftercreate(), auto-populated stubs have only the discriminatorcodebut novalueQuantity:Scope
src/api/writer-generator/typescript/profile-validation.ts