handle R3 encoding of primitive values when validating profiles
This commit is contained in:
parent
7ad4bd62c6
commit
bda3a74b40
|
@ -164,29 +164,30 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
tc = type.getExtensionValue(ToolingExtensions.EXT_FHIR_TYPE).primitiveValue();
|
||||
}
|
||||
if (Utilities.noString(tc) && type.hasChild("code")) {
|
||||
throw new Error("Snapshot for " + sd.getId() +" element " + path + " has type.code without a value ");
|
||||
// if (type.getNamedChild("code").hasExtension(" http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type")) {
|
||||
// tc = "*";
|
||||
// }
|
||||
}
|
||||
typeCodes.add(tc);
|
||||
Set<String> tcharacteristics = new HashSet<>();
|
||||
StructureDefinition tsd = context.fetchTypeDefinition(tc);
|
||||
if (tsd != null && tsd.hasExtension(ToolingExtensions.EXT_TYPE_CHARACTERISTICS)) {
|
||||
for (Extension ext : tsd.getExtensionsByUrl(ToolingExtensions.EXT_TYPE_CHARACTERISTICS)) {
|
||||
tcharacteristics.add(ext.getValue().primitiveValue());
|
||||
if (VersionUtilities.isR4Plus(context.getVersion())) {
|
||||
throw new Error("Snapshot for " + sd.getId() +" element " + path + " has type.code without a value ");
|
||||
}
|
||||
} else {
|
||||
// nothing specified, so infer from known types
|
||||
addCharacteristics(tcharacteristics, tc);
|
||||
}
|
||||
characteristics.addAll(tcharacteristics);
|
||||
if (type.hasChildren("targetProfile")) {
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stack.getLiteralPath(), tcharacteristics.contains("has-target") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "targetProfile", tc) && ok;
|
||||
}
|
||||
// check the stated profile - must be a constraint on the type
|
||||
if (snapshot || sd != null) {
|
||||
ok = validateElementType(errors, type, stack.push(type, -1, null, null), sd, path) && ok;
|
||||
if (!Utilities.noString(tc)) {
|
||||
typeCodes.add(tc);
|
||||
Set<String> tcharacteristics = new HashSet<>();
|
||||
StructureDefinition tsd = context.fetchTypeDefinition(tc);
|
||||
if (tsd != null && tsd.hasExtension(ToolingExtensions.EXT_TYPE_CHARACTERISTICS)) {
|
||||
for (Extension ext : tsd.getExtensionsByUrl(ToolingExtensions.EXT_TYPE_CHARACTERISTICS)) {
|
||||
tcharacteristics.add(ext.getValue().primitiveValue());
|
||||
}
|
||||
} else {
|
||||
// nothing specified, so infer from known types
|
||||
addCharacteristics(tcharacteristics, tc);
|
||||
}
|
||||
characteristics.addAll(tcharacteristics);
|
||||
if (type.hasChildren("targetProfile")) {
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stack.getLiteralPath(), tcharacteristics.contains("has-target") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "targetProfile", tc) && ok;
|
||||
}
|
||||
// check the stated profile - must be a constraint on the type
|
||||
if (snapshot || sd != null) {
|
||||
ok = validateElementType(errors, type, stack.push(type, -1, null, null), sd, path) && ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeMustSupport) {
|
||||
|
|
Loading…
Reference in New Issue