Support fully defining resources using caret rules #1530
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.
Description:
A contained resource can be defined within another resource one rule at a time using caret rules. By setting the resourceType of the contained resource, SUSHI will be able to correctly validate other rules that build up the contained resource. Most of the logic for this already existed, but some additional code was needed in order to collect information about inline resource types. Additionally, if an instance is assigned with a caret rule, further caret rules may be used to modify the contained resource. This gets a little complicated when exporting a StructureDefinition.
A ValueSet may refer to a CodeSystem that is defined with caret rules on the ValueSet. The resulting compose element will look the same as if the inline CodeSystem were defined separately.
Log a warning when an example instance is assigned within a conformance resource.
Update object definitions for inline instance tests so that the Instances are, in fact, inline.
Testing Instructions:
Please check for completeness of test cases. This change involves a lot of small variations in possible input scenarios, and while the code coverage tool reports that my new code is covered by the new tests, there may be unique combinations that merit their own tests.
The new warning message for example instances within conformance instances might need some revision. It's maybe a little too casual right now.
The changes to the exporters are similar, but not always the same. But, there may be some opportunities to pull out similar blocks into shared functions.
Additionally, I left a question in my implementation in
StructureDefinitionExporter
in regards to re-cleaning contained resources. Please consider whether a different strategy for re-cleaning would be necessary or useful.An initial regression of the 100 most recently updated projects showed no changes. This isn't too surprising, as this change is mostly to allow for new things that currently do not work.
Related Issue:
Fixes #1404.