Fix for validating extensions on R5 resources in R4 (R4 special case)

This commit is contained in:
Grahame Grieve 2023-11-07 09:14:42 +11:00
parent 841de5657e
commit 0685bc7a81
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;