Hello all,
I will try to be consise:
In the class SnapshotGeneratingValidationSupport, method generateSnapshot, I think that there is a problem with the Fhir R5 case:
case R5:
org.hl7.fhir.r5.model.StructureDefinition generatedR5 = (org.hl7.fhir.r5.model.StructureDefinition) converter.fromCanonical(inputCanonical);
((org.hl7.fhir.r5.model.StructureDefinition) theInput).getSnapshot().getElement().clear();
((org.hl7.fhir.r5.model.StructureDefinition) theInput).getSnapshot().getElement().addAll(generatedR5.getSnapshot().getElement());
break;
Indeed, when using R5, the "theInput" entity, the inputCanonical and the generatedR5 instances are all the sames instances.
Why? whereas in DSTU3/R4 version, when the method "fromCanonical" is called, we just return the instance because no need to use a converter.
The problem is that when doing "clear()" on the "theInput" list, it is also done on generatedR5 and the snapshot list become empty.
I succeed to fix the problem just by do nothing for the R5 case but I think that to fix the bug properly we need to inspect more.
The exception thrown in my case:
ProfileUtilities class, method updateFromDefinition, line with text:
"ElementDefinition e = profile.getSnapshot().getElement().get(0);"
IndexOutOfBoundsException: Index 0, Size: 0.
Exception because the snapshot line is empty.
Step to reproduce the problem:
During the snapshot generation of the custom Organization, the exception is thrown.
Thank you for your help.