fix bug copying constraints into Bundle.entry.resource profiles
This commit is contained in:
parent
3a1946e37d
commit
7d4b36a582
|
@ -16,6 +16,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.SlicingRules;
|
import org.hl7.fhir.r5.model.ElementDefinition.SlicingRules;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome.IssueType;
|
import org.hl7.fhir.r5.model.OperationOutcome.IssueType;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
@ -621,7 +622,12 @@ public class ProfilePathProcessor {
|
||||||
if (firstTypeStructureDefinition.getSnapshot().getElement().isEmpty()) {
|
if (firstTypeStructureDefinition.getSnapshot().getElement().isEmpty()) {
|
||||||
throw new FHIRException(profileUtilities.getContext().formatMessage(I18nConstants.SNAPSHOT_IS_EMPTY, firstTypeStructureDefinition.getVersionedUrl(), "Source for first element"));
|
throw new FHIRException(profileUtilities.getContext().formatMessage(I18nConstants.SNAPSHOT_IS_EMPTY, firstTypeStructureDefinition.getVersionedUrl(), "Source for first element"));
|
||||||
} else {
|
} else {
|
||||||
src = firstTypeStructureDefinition.getSnapshot().getElement().get(0);
|
src = firstTypeStructureDefinition.getSnapshot().getElement().get(0).copy();
|
||||||
|
if (!src.getPath().contains(".") && firstTypeStructureDefinition.getKind() == StructureDefinitionKind.RESOURCE) {
|
||||||
|
// we can't migrate the constraints in this case, because the sense of %resource changes when the root resource
|
||||||
|
// is treated as an element. The validator will enforce the constraint
|
||||||
|
src.getConstraint().clear(); //
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template = src.copy().setPath(currentBase.getPath());
|
template = src.copy().setPath(currentBase.getPath());
|
||||||
|
|
Loading…
Reference in New Issue