FHIR / sushi

SUSHI (aka "SUSHI Unshortens Short Hand Inputs") is a reference implementation command-line interpreter/compiler for FHIR Shorthand (FSH).
Apache License 2.0
145 stars 44 forks source link

Only return FshType id from rule value if the value is a string #1524

Closed mint-thompson closed 1 week ago

mint-thompson commented 1 week ago

Description: When getting the id for a FshType, rules are checked to see if there is one that will set the id and does not refer to an instance. A value that is not a string will not be valid and not be applied. Therefore, only return the value if it is a string.

Rename test file for FshCodeSystem to match name of source file.

Testing Instructions: Confirm that using a non-string value in a rule that sets an entity's id does not allow for other rules to fish up that entity using that id. The sample FSH from the issue is an example of this on an Instance:

Instance: requireddataforantimicro-response
InstanceOf: Questionnaire
Usage: #example
* id = 3193360

In this case, an error will be logged for the id rule since it is the wrong type, and there should not be a call stack overflow as described in the linked issue. Behavior should be the same for Profile, Extension, Logical, Resource, CodeSystem, and ValueSet, although these entities will set id using a caret rule, not an assignment rule.

Related Issue: Fixes #1519.