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 705d2e4ce..a997271fe 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 @@ -1722,6 +1722,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte transforms.listAllM(result); plans.listAllM(result); questionnaires.listAllM(result); + systems.listAllM(result); return result; } } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java index 78ba56a04..b9ce471f9 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java @@ -28,6 +28,8 @@ import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType; +import org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent; import org.hl7.fhir.r5.renderers.RendererFactory; import org.hl7.fhir.r5.renderers.utils.RenderingContext; import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode; @@ -760,6 +762,13 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst if (Utilities.existsInList(url, "http://loinc.org", "http://unitsofmeasure.org", "http://snomed.info/sct")) { return true; } + for (CanonicalResource cr : context.allConformanceResources()) { + if (cr instanceof NamingSystem) { + if (hasURL((NamingSystem) cr, url)) { + return true; + } + } + } if (url.contains("example.org") || url.contains("acme.com")) { return false; // todo... how to access settings from here? } @@ -773,6 +782,15 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst return false; } + private boolean hasURL(NamingSystem ns, String url) { + for (NamingSystemUniqueIdComponent uid : ns.getUniqueId()) { + if (uid.getType() == NamingSystemIdentifierType.URI && uid.hasValue() && uid.getValue().equals(url)) { + return true; + } + } + return false; + } + @Override public CanonicalResource fetchCanonicalResource(IResourceValidator validator, String url) throws URISyntaxException { Resource res = context.fetchResource(Resource.class, url); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java index 6f0e22679..c829567bd 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java @@ -8,6 +8,7 @@ import org.hl7.fhir.r5.formats.IParser; import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.renderers.spreadsheets.CodeSystemSpreadsheetGenerator; import org.hl7.fhir.r5.renderers.spreadsheets.ConceptMapSpreadsheetGenerator; @@ -315,15 +316,19 @@ public class ValidationService { if (issue.hasExpression()) { int line = ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_LINE, -1); int col = ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_COL, -1); - loc = issue.getExpression().get(0).asStringValue() + (line >= 0 && col >= 0 ? " (line " + Integer.toString(line) + ", col" + Integer.toString(col) + ")" : ""); + loc = " @ "+issue.getExpression().get(0).asStringValue() + (line >= 0 && col >= 0 ? " (line " + Integer.toString(line) + ", col" + Integer.toString(col) + ")" : ""); } else if (issue.hasLocation()) { - loc = issue.getLocation().get(0).asStringValue(); + loc = " @ "+issue.getLocation().get(0).asStringValue(); } else { int line = ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_LINE, -1); int col = ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_COL, -1); - loc = (line >= 0 && col >= 0 ? "line " + Integer.toString(line) + ", col" + Integer.toString(col) : "??"); + if (issue.getSeverity() == IssueSeverity.INFORMATION && (line == -1 || col == -1)) { + loc = ""; + } else { + loc = " @ "+(line >= 0 && col >= 0 ? "line " + Integer.toString(line) + ", col" + Integer.toString(col) : "??"); + } } - return " " + issue.getSeverity().getDisplay() + " @ " + loc + " : " + issue.getDetails().getText(); + return " " + issue.getSeverity().getDisplay() + loc + ": " + issue.getDetails().getText(); } public String determineVersion(CliContext cliContext) throws Exception {