Merge pull request #1482 from hapifhir/2023-11-gg-r5-specials

Fix for validating extensions on R5 resources in R4 (R4 special case)
This commit is contained in:
Grahame Grieve 2023-11-07 10:03:01 +11:00 committed by GitHub
commit 650b4a57df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -407,6 +407,17 @@ public class VersionUtilities {
}
/** same as getCanonicalResourceNames but add R5 supported types that are canonical too */
public static Set<String> getExtendedCanonicalResourceNames(String version) {
Set<String> res = getCanonicalResourceNames(version);
if (isR4Ver(version)) {
res.add("ActorDefinition");
res.add("Requirements");
res.add("SubscriptionTopic");
res.add("TestPlan");
}
return res;
}
public static Set<String> getCanonicalResourceNames(String version) {
Set<String> res = new HashSet<String>();

View File

@ -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;