diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index fdc11fd65..9babd89fd 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -73,6 +73,7 @@ import org.hl7.fhir.r5.model.DomainResource; import org.hl7.fhir.r5.model.ElementDefinition; import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent; import org.hl7.fhir.r5.model.Enumerations.PublicationStatus; +import org.hl7.fhir.r5.model.IdType; import org.hl7.fhir.r5.model.ImplementationGuide; import org.hl7.fhir.r5.model.Library; import org.hl7.fhir.r5.model.Measure; @@ -868,7 +869,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte // if that failed, we try to expand on the server if (addDependentResources(p, vs)) { - p.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId())); + p.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId())); } if (noTerminologyServer) { @@ -1147,7 +1148,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte boolean cached = addDependentResources(p, vs); if (cached) { - p.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId())); + p.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId())); } return p; } @@ -1276,7 +1277,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte addDependentResources(pin, vs); } if (cache) { - pin.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId())); + pin.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId())); } for (ParametersParameterComponent pp : pin.getParameter()) { if (pp.getName().equals("profile")) { @@ -1917,6 +1918,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte private Set notCanonical = new HashSet(); protected IWorkerContextManager.IPackageLoadingTracker packageTracker; + private boolean forPublication; @Override public Resource fetchResourceById(String type, String uri) { @@ -2467,4 +2469,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte // TODO Auto-generated method stub return new PEBuilder(this, elementProps, fixedProps); } + + public boolean isForPublication() { + return forPublication; + } + + public void setForPublication(boolean value) { + forPublication = value; + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java index 62950a9c8..6a402c70d 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java @@ -274,6 +274,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider { ProfileUtilities pu = new ProfileUtilities(context, msgs, this); pu.setAutoFixSliceNames(true); pu.setThrowException(false); + pu.setForPublication(context.isForPublication()); if (xverManager == null) { xverManager = new XVerExtensionManager(context); } @@ -282,8 +283,9 @@ public class ContextUtilities implements ProfileKnowledgeProvider { pu.sortDifferential(sd, p, p.getUrl(), errors, true); } pu.setDebug(false); - for (String err : errors) + for (String err : errors) { msgs.add(new ValidationMessage(Source.ProfileValidator, IssueType.EXCEPTION, p.getWebPath(), "Error sorting Differential: "+err, ValidationMessage.IssueSeverity.ERROR)); + } pu.generateSnapshot(sd, p, p.getUrl(), sd.getUserString("webroot"), p.getName()); for (ValidationMessage msg : msgs) { if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java index 9b90702ea..b54fd07a9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java @@ -941,4 +941,6 @@ public interface IWorkerContext { public PEBuilder getProfiledElementBuilder(PEElementPropertiesPolicy elementProps, boolean fixedProps); + public boolean isForPublication(); + public void setForPublication(boolean value); } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java index 890cb700d..198cdae79 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java @@ -544,7 +544,7 @@ public class Coding extends DataType implements IBaseCoding, ICompositeType, ICo base = base+"|"+getVersion(); base = base + "#"+getCode(); if (hasDisplay()) - base = base+": "+getDisplay(); + base = base+": '"+getDisplay()+"'"; return base; } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 093c6a696..92176065a 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -5968,14 +5968,30 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } } if (match) { + boolean update = true; boolean isOk = ei.definition == null || ei.definition == slicer || (ei.definition.getPath().endsWith("[x]") && ed.getPath().startsWith(ei.definition.getPath().replace("[x]", ""))); + if (!isOk) { + // is this a subslice? then we put it in as a replacement + String existingName = ei.definition == null || !ei.definition.hasSliceName() ? null : ei.definition.getSliceName(); + String matchingName = ed.hasSliceName() ? ed.getSliceName() : null; + if (existingName != null && matchingName != null) { + if (matchingName.startsWith(existingName+"/")) { + isOk = true; + } else if (existingName.startsWith(matchingName+"/")) { + update = false; + isOk = true; + } + } + } if (rule(errors, NO_RULE_DATE, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), isOk, I18nConstants.VALIDATION_VAL_PROFILE_MATCHMULTIPLE, profile.getVersionedUrl(), (ei.definition == null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()), (ed.hasSliceName() ? ed.getSliceName() : ""))) { - ei.definition = ed; - if (ei.slice == null) { - ei.index = i; - } else { - ei.index = sliceOffset; - ei.sliceindex = i - (sliceOffset + 1); + if (update) { + ei.definition = ed; + if (ei.slice == null) { + ei.index = i; + } else { + ei.index = sliceOffset; + ei.sliceindex = i - (sliceOffset + 1); + } } } } else if (childUnsupportedSlicing) {