Skip to content

Fix building mappings in snapshot mode when parent has no mappings#1618

Open
cmoesel wants to merge 2 commits intomasterfrom
fix-snapshot-error
Open

Fix building mappings in snapshot mode when parent has no mappings#1618
cmoesel wants to merge 2 commits intomasterfrom
fix-snapshot-error

Conversation

@cmoesel
Copy link
Copy Markdown
Member

@cmoesel cmoesel commented Mar 28, 2026

Description: If a parent SD has no mappings, then StructureDefinition.originalMapping will be empty (e.g., []). During export, SDs are "cleaned" and properties that are empty arrays are deleted (since empty arrays are not allowed in FHIR). When originalMapping was deleted, however, the code that builds the mappings in snapshot mode crashes trying to dereference originalMapping. Now an undefined originalMapping will be treated as an empty array (which is what it was before cleaning).

Testing Instructions: You can reproduce this using the project from #1616:

git clone https://github.com/medizininformatik-initiative/kerndatensatzmodul-onkologie.git
cd kerndatensatzmodul-onkologie
git checkout dev
sushi . --snapshot  # crashes

On master it will crash but on this PR branch the build will succeed.

Related Issue: #1616

cmoesel added 2 commits March 28, 2026 09:35
In the case that an originalMapping is empty ([]), it might get cleaned and deleted. Usually this is ok, but when building snapshots, we reference it to build the mapping, so we need to treat an undefined originalMapping like [] if that occasion arises.

Fixes #1616
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.

1 participant