diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 5913bc2f4..586b75858 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -142,23 +142,23 @@ Terminology_TX_Error_CodeableConcept = Error {0} validating CodeableConcept Terminology_TX_Error_CodeableConcept_Max = Error {0} validating CodeableConcept using maxValueSet Terminology_TX_Error_Coding1 = Error {0} validating Coding Terminology_TX_Error_Coding2 = Error {0} validating Coding: {1} -Terminology_TX_NoValid_1 = None of the codes provided are in the value set {0} ({1}, and a code from this value set is required) (codes = {2}) -Terminology_TX_NoValid_10 = The code provided is not in the maximum value set {0} ({1}, and a code from this value set is required) (code = {2}#{3}) -Terminology_TX_NoValid_11 = The code provided is not in the maximum value set {0} ({1}{2} +Terminology_TX_NoValid_1 = None of the codes provided are in the value set {0} ({1}), and a code from this value set is required) (codes = {2}) +Terminology_TX_NoValid_10 = The code provided is not in the maximum value set {0} ({1}), and a code from this value set is required) (code = {2}#{3}) +Terminology_TX_NoValid_11 = The code provided is not in the maximum value set {0} ({1}{2}) Terminology_TX_NoValid_12 = The Coding provided is not in the value set {0}, and a code is required from this value set. {1} Terminology_TX_NoValid_13 = The Coding provided is not in the value set {0}, and a code should come from this value set unless it has no suitable code. {1} Terminology_TX_NoValid_14 = The Coding provided is not in the value set {0}, and a code is recommended to come from this value set. {1} Terminology_TX_NoValid_15 = The value provided ("{0}") could not be validated in the absence of a terminology server -Terminology_TX_NoValid_16 = The value provided ("{0}") is not in the value set {1} ({2}, and a code is required from this value set){3} -Terminology_TX_NoValid_17 = The value provided ("{0}") is not in the value set {1} ({2}, and a code should come from this value set unless it has no suitable code){3} -Terminology_TX_NoValid_18 = The value provided ("{0}") is not in the value set {1} ({2}, and a code is recommended to come from this value set){3} -Terminology_TX_NoValid_2 = None of the codes provided are in the value set {0} ({1}, and a code should come from this value set unless it has no suitable code) (codes = {2}) -Terminology_TX_NoValid_3 = None of the codes provided are in the value set {0} ({1}, and a code is recommended to come from this value set) (codes = {2}) +Terminology_TX_NoValid_16 = The value provided ("{0}") is not in the value set {1} ({2}), and a code is required from this value set){3} +Terminology_TX_NoValid_17 = The value provided ("{0}") is not in the value set {1} ({2}), and a code should come from this value set unless it has no suitable code){3} +Terminology_TX_NoValid_18 = The value provided ("{0}") is not in the value set {1} ({2}), and a code is recommended to come from this value set){3} +Terminology_TX_NoValid_2 = None of the codes provided are in the value set {0} ({1}), and a code should come from this value set unless it has no suitable code) (codes = {2}) +Terminology_TX_NoValid_3 = None of the codes provided are in the value set {0} ({1}), and a code is recommended to come from this value set) (codes = {2}) Terminology_TX_NoValid_4 = The Coding provided is not in the value set {0}, and a code is required from this value set{1} Terminology_TX_NoValid_5 = The Coding provided is not in the value set {0}, and a code should come from this value set unless it has no suitable code{1} Terminology_TX_NoValid_6 = The Coding provided is not in the value set {0}, and a code is recommended to come from this value set{1} Terminology_TX_NoValid_7 = None of the codes provided could be validated against the maximum value set {0} ({1}), (error = {2}) -Terminology_TX_NoValid_8 = None of the codes provided are in the maximum value set {0} ({1}, and a code from this value set is required) (codes = {2}) +Terminology_TX_NoValid_8 = None of the codes provided are in the maximum value set {0} ({1}), and a code from this value set is required) (codes = {2}) Terminology_TX_NoValid_9 = The code provided could not be validated against the maximum value set {0} ({1}), (error = {2}) Terminology_TX_System_Invalid = Invalid System URI: {0} Terminology_TX_System_NotKnown = Code System URI "{0}" is unknown so the code cannot be validated 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 b622febb4..002eb38b0 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 @@ -2827,6 +2827,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat rr.setFocus(res.getMatch()); rr.setExternal(false); rr.setStack(stack.push(res.getMatch(), res.getIndex(), res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition())); + rr.getStack().qualifyPath(".ofType("+stack.getElement().fhirType()+")"); return rr; } } @@ -2861,6 +2862,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat rr.setStack(stack.push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(), res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1, res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition())); + rr.getStack().qualifyPath(".ofType("+rr.getResource().fhirType()+")"); return rr; } } @@ -2882,6 +2884,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat rr.setStack(new NodeStack(context, hostContext, validationLanguage).push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(), res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1, res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition())); + rr.getStack().qualifyPath(".ofType("+rr.getResource().fhirType()+")"); return rr; } } @@ -3832,6 +3835,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat break; } } + stack.qualifyPath(".ofType("+resourceName+")"); if (trr == null) { rule(errors, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.BUNDLE_BUNDLE_ENTRY_TYPE, resourceName); } else if (isValidResourceType(resourceName, trr)) { diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/NodeStack.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/NodeStack.java index 1c73c6c73..c3c1e234c 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/NodeStack.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/NodeStack.java @@ -173,5 +173,10 @@ public class NodeStack { return parent; } + public void qualifyPath(String qualifier) { + literalPath = literalPath + qualifier; + + } + } diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java index 80f2962f3..7c64674bd 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java @@ -146,35 +146,12 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour vCurr.loadIg(e.getAsString(), true); } } - if (content.has("questionnaire")) { - String filename = content.get("questionnaire").getAsString(); - String contents = TestingUtilities.loadTestResource("validator", filename); - vCurr.getContext().cacheResource(loadResource(filename, contents)); - } - if (content.has("measure")) { - String filename = content.get("measure").getAsString(); - String contents = TestingUtilities.loadTestResource("validator", filename); - vCurr.getContext().cacheResource(loadResource(filename, contents)); - } - if (content.has("library")) { - String filename = content.get("library").getAsString(); - String contents = TestingUtilities.loadTestResource("validator", filename); - vCurr.getContext().cacheResource(loadResource(filename, contents)); - } - if (content.has("codesystems")) { - for (JsonElement je : content.getAsJsonArray("codesystems")) { - String filename = je.getAsString(); + if (content.has("supporting")) { + for (JsonElement e : content.getAsJsonArray("supporting")) { + String filename = e.getAsString(); String contents = TestingUtilities.loadTestResource("validator", filename); - CodeSystem sd = (CodeSystem) loadResource(filename, contents); - val.getContext().cacheResource(sd); - } - } - if (content.has("valuesets")) { - for (JsonElement je : content.getAsJsonArray("valuesets")) { - String filename = je.getAsString(); - String contents = TestingUtilities.loadTestResource("validator", filename); - ValueSet vs = (ValueSet) loadResource(filename, contents); - val.getContext().cacheResource(vs); + CanonicalResource mr = (CanonicalResource) loadResource(filename, contents); + val.getContext().cacheResource(mr); } } if (content.has("profiles")) {