diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index ef77fda91..4c0b50db6 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -407,6 +407,17 @@ public class VersionUtilities { } + /** same as getCanonicalResourceNames but add R5 supported types that are canonical too */ + public static Set getExtendedCanonicalResourceNames(String version) { + Set res = getCanonicalResourceNames(version); + if (isR4Ver(version)) { + res.add("ActorDefinition"); + res.add("Requirements"); + res.add("SubscriptionTopic"); + res.add("TestPlan"); + } + return res; + } public static Set getCanonicalResourceNames(String version) { Set res = new HashSet(); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 0bc29f1b2..4d013d967 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -2218,7 +2218,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat ok = true; } else if (en.equals("Resource") && container.isResource()) { ok = true; - } else if (en.equals("CanonicalResource") && VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(stack.getLiteralPath())) { + } else if (en.equals("CanonicalResource") && VersionUtilities.getExtendedCanonicalResourceNames(context.getVersion()).contains(stack.getLiteralPath())) { ok = true; } else if (hasElementName(plist, en) && pu == null) { ok = true;