From b0c1f2b12923e99fdeef93238e9469f6c4c5eea5 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 24 Jun 2021 21:48:27 +1000 Subject: [PATCH] fix bug validating profiles on bundle.entry.resource --- .../instance/type/StructureDefinitionValidator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java index e9aaedfcc..311b05973 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java @@ -291,8 +291,8 @@ public class StructureDefinitionValidator extends BaseValidator { StructureDefinition t = determineBaseType(sd); if (t == null) { rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p); - } else { - rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), isInstanceOf(t, code), I18nConstants.SD_ED_TYPE_PROFILE_WRONG, p, t, code, path); + } else if (!isInstanceOf(t, code)) { + rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_WRONG, p, t, code, path); } } } @@ -343,7 +343,7 @@ public class StructureDefinitionValidator extends BaseValidator { } private StructureDefinition determineBaseType(StructureDefinition sd) { - while (sd != null && !sd.hasType() && sd.getDerivation() == TypeDerivationRule.CONSTRAINT) { + while (sd != null && sd.getDerivation() == TypeDerivationRule.CONSTRAINT) { sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); } return sd;