Skip to content

TS: Validate required fields inside slice elements#130

Merged
ryukzak merged 3 commits intomainfrom
fix-slice-field-validation
Apr 8, 2026
Merged

TS: Validate required fields inside slice elements#130
ryukzak merged 3 commits intomainfrom
fix-slice-field-validation

Conversation

@ryukzak
Copy link
Copy Markdown
Collaborator

@ryukzak ryukzak commented Apr 6, 2026

Summary

  • Add validateSliceFields runtime helper that checks required fields within matched slice elements
  • Generate validateSliceFields calls for slices with required fields beyond match keys or constrained choices
  • For BP profile: validates that valueQuantity is present in systolic/diastolic component stubs

Before:

profile.validate().errors
// ["at least one of effectiveDateTime, effectivePeriod is required"]

After:

profile.validate().errors
// [
//   "at least one of effectiveDateTime, effectivePeriod is required",
//   "component[SystolicBP].valueQuantity is required",
//   "component[DiastolicBP].valueQuantity is required",
// ]

Closes #123

ryukzak added 3 commits April 7, 2026 17:30
Add validateSliceFields helper that checks required fields within matched
slice elements. For constrained choice slices (e.g. BP component with
value[x] restricted to valueQuantity), the variant is validated as required.

Before: validate() only checked slice cardinality
After:  also reports "component[SystolicBP].valueQuantity is required"
@ryukzak ryukzak force-pushed the fix-slice-field-validation branch from bdabe95 to 07e565e Compare April 7, 2026 15:33
@ryukzak ryukzak merged commit f9c36c8 into main Apr 8, 2026
31 checks passed
@ryukzak ryukzak deleted the fix-slice-field-validation branch April 8, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS: validate() should check required fields inside slice elements

1 participant