TS: Fix profile apply/create, fix slice match arrays, rewrite example tests - #121
Merged
Conversation
ryukzak
force-pushed
the
fix-profile-class-issues
branch
from
April 1, 2026 13:57
9f0af81 to
75a53b9
Compare
ryukzak
force-pushed
the
fix-profile-class-issues
branch
from
April 1, 2026 14:08
75a53b9 to
06938d0
Compare
ryukzak
force-pushed
the
fix-profile-class-issues
branch
from
April 2, 2026 08:08
06938d0 to
d51c12b
Compare
… wrapping - apply() sets fixed-value fields and auto-populates discriminator-only slice stubs, matching create() behavior - apply() skips redundant resourceType assignment - Only auto-populate slices where the stub is the complete content (e.g. category VSCat). Skip type discriminators (Bundle entry) and slices with required fields beyond match keys (BP component) - Fix computeMatchFromSchema to wrap sliced elements in arrays (e.g. component code.coding), matching the fhirschema 0.0.10 fix - Fixed-value fields get a getter but no setter - create() split into createResource + apply for readability - Extension apply() sets URL, uses upsert for single extensions
Slice match values now correctly wrap array elements (e.g. coding is Coding[] not a plain object).
- Three demos on top: create (with validation flow), apply, from/read - Concise regression tests below for edge cases - Remove all as-any / as-never / as-unknown casts - Add resource snapshots for fully populated profiles
ryukzak
force-pushed
the
fix-profile-class-issues
branch
from
April 2, 2026 10:04
d51c12b to
a3bf7f2
Compare
Adds gender, birthDate, and toMatchSnapshot() to the patient demo test to capture a fully valid US Core Patient with extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Profile class fixes
apply()now sets fixed-value fields and auto-populates discriminator-only slice stubs, matchingcreate()behaviorapply()no longer redundantly assignsresourceTypecreate()split intocreateResource+applyfor readabilityapply()sets URL, uses upsert for single extensionsSlice match array fixes
@atomic-ehr/fhirschema0.0.9 → 0.0.10 (fix: Wrap slice match values in arrays for array elements fhirschema#15) — fixesbuildMatchForSlicewrappingcomputeMatchFromSchemain codegen now also wraps sliced elements in arrays (fixes R4 BPcomponent.code.codingfrom plain object toCoding[])Example test rewrite
as any/as never/as unknowncastsBefore/After
apply()— now auto-populates fixed fields and discriminator-only slices:Slice auto-population — only for discriminator-complete slices:
Slice match data —
codingnow correctly wrapped as array everywhere: