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

Improve error message for code caret rule on ValueSet compose component without any concept #1518

Open mint-thompson opened 3 weeks ago

mint-thompson commented 3 weeks ago

When writing rules for a ValueSet, it is invalid to make a code caret rule on a concept that is not specifically present within the ValueSet.. However, when there are no specific concepts present, a slightly strange error message is produced.

Sample FSH:

ValueSet: SomeVS
* include codes from system http://example.org/CS
* http://example.org/CS#"some-code" ^designation.value = "some value"

Error message received:

error The element or path you referenced does not exist: compose.include[0].concept[undefined].designation.value
  Line: 3

The rule path in the error message is the path constructed within the ValueSetExporter for the rule on line 3. But, it might be more useful to directly indicate that the rule is invalid because there is no concept array in the compose element with http://example.org/CS as the system.