handle R3 encoding of primitive values when validating profiles

This commit is contained in:
Grahame Grieve 2023-01-31 07:23:33 +11:00
parent 7ad4bd62c6
commit bda3a74b40

View File

@ -164,11 +164,11 @@ public class StructureDefinitionValidator extends BaseValidator {
tc = type.getExtensionValue(ToolingExtensions.EXT_FHIR_TYPE).primitiveValue(); tc = type.getExtensionValue(ToolingExtensions.EXT_FHIR_TYPE).primitiveValue();
} }
if (Utilities.noString(tc) && type.hasChild("code")) { if (Utilities.noString(tc) && type.hasChild("code")) {
if (VersionUtilities.isR4Plus(context.getVersion())) {
throw new Error("Snapshot for " + sd.getId() +" element " + path + " has type.code without a value "); 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 = "*";
// }
} }
}
if (!Utilities.noString(tc)) {
typeCodes.add(tc); typeCodes.add(tc);
Set<String> tcharacteristics = new HashSet<>(); Set<String> tcharacteristics = new HashSet<>();
StructureDefinition tsd = context.fetchTypeDefinition(tc); StructureDefinition tsd = context.fetchTypeDefinition(tc);
@ -189,6 +189,7 @@ public class StructureDefinitionValidator extends BaseValidator {
ok = validateElementType(errors, type, stack.push(type, -1, null, null), sd, path) && ok; ok = validateElementType(errors, type, stack.push(type, -1, null, null), sd, path) && ok;
} }
} }
}
if (typeMustSupport) { if (typeMustSupport) {
if (snapshot) { if (snapshot) {
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), "true".equals(element.getChildValue("mustSupport")), I18nConstants.SD_NESTED_MUST_SUPPORT_SNAPSHOT, path) && ok; ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), "true".equals(element.getChildValue("mustSupport")), I18nConstants.SD_NESTED_MUST_SUPPORT_SNAPSHOT, path) && ok;