From 1a14bfc9e8e606810bf7b20e1fe641801c4c5d5c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 2 Sep 2019 16:04:21 +1000 Subject: [PATCH] Change rules about how maxValueSet is validated --- .../org/hl7/fhir/r5/validation/InstanceValidator.java | 8 ++++++-- .../src/test/resources/validation-examples/manifest.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java index 2e6dffe01..34e89f60f 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -1027,8 +1027,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (!cc.hasCoding()) { if (binding.getStrength() == BindingStrength.REQUIRED) rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code must be provided from the value set " + describeReference(ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + " (max value set " + valueset.getUrl()+")"); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+")"); + } } else { long t = System.nanoTime(); diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json index 6768327e0..61ce6621b 100644 --- a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json @@ -872,7 +872,7 @@ "errorCount": 0, "profile": { "source": "maxvalueset-profile.xml", - "errorCount": 0 + "errorCount": 1 } }, "observation-maxvs-wrong.xml": {