#357: fix bug looking for contained resources inside bundles
This commit is contained in:
parent
47dd580868
commit
e4d3047138
|
@ -1,5 +1,6 @@
|
||||||
Validator:
|
Validator:
|
||||||
* check StructureDefinition derivation consistency
|
* check StructureDefinition derivation consistency
|
||||||
|
* fix bug looking for contained resources inside bundles
|
||||||
|
|
||||||
Other code changes:
|
Other code changes:
|
||||||
* Add support for new FHIR releases
|
* Add support for new FHIR releases
|
|
@ -10036,6 +10036,7 @@ The primary difference between a medication statement and a medication administr
|
||||||
* R4B - manually added
|
* R4B - manually added
|
||||||
*/
|
*/
|
||||||
_4_1_0,
|
_4_1_0,
|
||||||
|
_4_3_0_SNAPSHOT1,
|
||||||
_4_3_0_CIBUILD,
|
_4_3_0_CIBUILD,
|
||||||
NULL;
|
NULL;
|
||||||
public static FHIRVersion fromCode(String codeString) throws FHIRException {
|
public static FHIRVersion fromCode(String codeString) throws FHIRException {
|
||||||
|
@ -10089,6 +10090,8 @@ The primary difference between a medication statement and a medication administr
|
||||||
return _4_0_1;
|
return _4_0_1;
|
||||||
if ("4.1.0".equals(codeString))
|
if ("4.1.0".equals(codeString))
|
||||||
return _4_1_0;
|
return _4_1_0;
|
||||||
|
if ("4.3.0-snapshot1".equals(codeString))
|
||||||
|
return _4_3_0_SNAPSHOT1;
|
||||||
if ("4.3.0-cibuild".equals(codeString))
|
if ("4.3.0-cibuild".equals(codeString))
|
||||||
return _4_3_0_CIBUILD;
|
return _4_3_0_CIBUILD;
|
||||||
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
|
@ -10123,6 +10126,7 @@ The primary difference between a medication statement and a medication administr
|
||||||
case _4_0_0: return "4.0.0";
|
case _4_0_0: return "4.0.0";
|
||||||
case _4_0_1: return "4.0.1";
|
case _4_0_1: return "4.0.1";
|
||||||
case _4_1_0: return "4.1.0";
|
case _4_1_0: return "4.1.0";
|
||||||
|
case _4_3_0_SNAPSHOT1: return "4.3.0-snapshot1";
|
||||||
case _4_3_0_CIBUILD: return "4.3.0-cibuild";
|
case _4_3_0_CIBUILD: return "4.3.0-cibuild";
|
||||||
|
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
|
@ -10155,6 +10159,7 @@ The primary difference between a medication statement and a medication administr
|
||||||
case _4_0_0: return "http://hl7.org/fhir/FHIR-version";
|
case _4_0_0: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case _4_0_1: return "http://hl7.org/fhir/FHIR-version";
|
case _4_0_1: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case _4_1_0: return "http://hl7.org/fhir/FHIR-version";
|
case _4_1_0: return "http://hl7.org/fhir/FHIR-version";
|
||||||
|
case _4_3_0_SNAPSHOT1: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case _4_3_0_CIBUILD: return "http://hl7.org/fhir/FHIR-version";
|
case _4_3_0_CIBUILD: return "http://hl7.org/fhir/FHIR-version";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
|
@ -10186,6 +10191,7 @@ The primary difference between a medication statement and a medication administr
|
||||||
case _4_0_0: return "FHIR Release 4 (Normative + STU).";
|
case _4_0_0: return "FHIR Release 4 (Normative + STU).";
|
||||||
case _4_0_1: return "FHIR Release 4 Technical Correction #1.";
|
case _4_0_1: return "FHIR Release 4 Technical Correction #1.";
|
||||||
case _4_1_0: return "FHIR Release 4B Ballot #1";
|
case _4_1_0: return "FHIR Release 4B Ballot #1";
|
||||||
|
case _4_3_0_SNAPSHOT1: return "FHIR Release 4B Snapshot #1";
|
||||||
case _4_3_0_CIBUILD: return "FHIR Release 4B CI-Builld";
|
case _4_3_0_CIBUILD: return "FHIR Release 4B CI-Builld";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
|
@ -10217,6 +10223,7 @@ The primary difference between a medication statement and a medication administr
|
||||||
case _4_0_0: return "4.0.0";
|
case _4_0_0: return "4.0.0";
|
||||||
case _4_0_1: return "4.0.1";
|
case _4_0_1: return "4.0.1";
|
||||||
case _4_1_0: return "4.1.0";
|
case _4_1_0: return "4.1.0";
|
||||||
|
case _4_3_0_SNAPSHOT1: return "4.3.0-snapshot";
|
||||||
case _4_3_0_CIBUILD: return "4.3.0-cibuild";
|
case _4_3_0_CIBUILD: return "4.3.0-cibuild";
|
||||||
case NULL: return null;
|
case NULL: return null;
|
||||||
default: return "?";
|
default: return "?";
|
||||||
|
@ -10283,6 +10290,8 @@ The primary difference between a medication statement and a medication administr
|
||||||
return FHIRVersion._4_0_1;
|
return FHIRVersion._4_0_1;
|
||||||
if ("4.1.0".equals(codeString))
|
if ("4.1.0".equals(codeString))
|
||||||
return FHIRVersion._4_1_0;
|
return FHIRVersion._4_1_0;
|
||||||
|
if ("4.3.0-snapshot1".equals(codeString))
|
||||||
|
return FHIRVersion._4_3_0_SNAPSHOT1;
|
||||||
if ("4.3.0-cibuild".equals(codeString))
|
if ("4.3.0-cibuild".equals(codeString))
|
||||||
return FHIRVersion._4_3_0_CIBUILD;
|
return FHIRVersion._4_3_0_CIBUILD;
|
||||||
throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
|
@ -10343,6 +10352,8 @@ The primary difference between a medication statement and a medication administr
|
||||||
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_0_1);
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_0_1);
|
||||||
if ("4.1.0".equals(codeString))
|
if ("4.1.0".equals(codeString))
|
||||||
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0);
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0);
|
||||||
|
if ("4.3.0-snapshot1".equals(codeString))
|
||||||
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_3_0_SNAPSHOT1);
|
||||||
if ("4.3.0-cibuild".equals(codeString))
|
if ("4.3.0-cibuild".equals(codeString))
|
||||||
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_3_0_CIBUILD);
|
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_3_0_CIBUILD);
|
||||||
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
|
||||||
|
@ -10396,6 +10407,8 @@ The primary difference between a medication statement and a medication administr
|
||||||
return "4.0.1";
|
return "4.0.1";
|
||||||
if (code == FHIRVersion._4_1_0)
|
if (code == FHIRVersion._4_1_0)
|
||||||
return "4.1.0";
|
return "4.1.0";
|
||||||
|
if (code == FHIRVersion._4_3_0_SNAPSHOT1)
|
||||||
|
return "4.3.0-snapshot1";
|
||||||
if (code == FHIRVersion._4_3_0_CIBUILD)
|
if (code == FHIRVersion._4_3_0_CIBUILD)
|
||||||
return "4.3.0-cibuild";
|
return "4.3.0-cibuild";
|
||||||
return "?";
|
return "?";
|
||||||
|
|
|
@ -304,8 +304,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
} else if (item instanceof Element) {
|
} else if (item instanceof Element) {
|
||||||
Element e = (Element) item;
|
Element e = (Element) item;
|
||||||
if (e.getSpecial() != null) {
|
if (e.getSpecial() == SpecialElement.CONTAINED) {
|
||||||
self.validateResource(new ValidatorHostContext(ctxt.getAppContext(), e, ctxt.getRootResource()), valerrors, e, e, sd, IdStatus.OPTIONAL, new NodeStack(context, null, e, validationLanguage));
|
self.validateResource(new ValidatorHostContext(ctxt.getAppContext(), e, ctxt.getRootResource()), valerrors, e, e, sd, IdStatus.OPTIONAL, new NodeStack(context, null, e, validationLanguage));
|
||||||
|
} else if (e.getSpecial() != null) {
|
||||||
|
self.validateResource(new ValidatorHostContext(ctxt.getAppContext(), e), valerrors, e, e, sd, IdStatus.OPTIONAL, new NodeStack(context, null, e, validationLanguage));
|
||||||
} else {
|
} else {
|
||||||
self.validateResource(new ValidatorHostContext(ctxt.getAppContext(), e), valerrors, e, e, sd, IdStatus.OPTIONAL, new NodeStack(context, null, e, validationLanguage));
|
self.validateResource(new ValidatorHostContext(ctxt.getAppContext(), e), valerrors, e, e, sd, IdStatus.OPTIONAL, new NodeStack(context, null, e, validationLanguage));
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1314,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
String system = c.getSystem();
|
String system = c.getSystem();
|
||||||
String display = c.getDisplay();
|
String display = c.getDisplay();
|
||||||
String version = c.getVersion();
|
String version = c.getVersion();
|
||||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isCodeSystemReferenceValid(system), I18nConstants.TERMINOLOGY_TX_SYSTEM_RELATIVE);
|
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, system == null || isCodeSystemReferenceValid(system), I18nConstants.TERMINOLOGY_TX_SYSTEM_RELATIVE);
|
||||||
|
|
||||||
if (system != null && code != null && !noTerminologyChecks) {
|
if (system != null && code != null && !noTerminologyChecks) {
|
||||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !isValueSet(system), I18nConstants.TERMINOLOGY_TX_SYSTEM_VALUESET2, system);
|
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !isValueSet(system), I18nConstants.TERMINOLOGY_TX_SYSTEM_VALUESET2, system);
|
||||||
|
@ -1568,7 +1570,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
|
|
||||||
private void checkCodedElement(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept, boolean checkDisplay, NodeStack stack,
|
private void checkCodedElement(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept, boolean checkDisplay, NodeStack stack,
|
||||||
String theCode, String theSystem, String theVersion, String theDisplay) {
|
String theCode, String theSystem, String theVersion, String theDisplay) {
|
||||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isCodeSystemReferenceValid(theSystem), I18nConstants.TERMINOLOGY_TX_SYSTEM_RELATIVE);
|
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, theSystem == null || isCodeSystemReferenceValid(theSystem), I18nConstants.TERMINOLOGY_TX_SYSTEM_RELATIVE);
|
||||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, Utilities.noString(theCode) || !Utilities.noString(theSystem), I18nConstants.TERMINOLOGY_TX_SYSTEM_NO_CODE);
|
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, Utilities.noString(theCode) || !Utilities.noString(theSystem), I18nConstants.TERMINOLOGY_TX_SYSTEM_NO_CODE);
|
||||||
|
|
||||||
if (theSystem != null && theCode != null && !noTerminologyChecks) {
|
if (theSystem != null && theCode != null && !noTerminologyChecks) {
|
||||||
|
@ -2023,7 +2025,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
|
|
||||||
private void checkIdentifier(List<ValidationMessage> errors, String path, Element element, ElementDefinition context) {
|
private void checkIdentifier(List<ValidationMessage> errors, String path, Element element, ElementDefinition context) {
|
||||||
String system = element.getNamedChildValue("system");
|
String system = element.getNamedChildValue("system");
|
||||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isIdentifierSystemReferenceValid(system), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_SYSTEM);
|
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, system == null || isIdentifierSystemReferenceValid(system), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_SYSTEM);
|
||||||
if ("urn:ietf:rfc:3986".equals(system)) {
|
if ("urn:ietf:rfc:3986".equals(system)) {
|
||||||
String value = element.getNamedChildValue("value");
|
String value = element.getNamedChildValue("value");
|
||||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(value), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE);
|
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(value), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE);
|
||||||
|
|
Loading…
Reference in New Issue