Merge pull request #1113 from hapifhir/gg-202302-core-qa
FHIR QA driven changes
This commit is contained in:
commit
3489df2ced
|
@ -480,6 +480,7 @@ public class VersionUtilities {
|
||||||
res.add("ResearchDefinition");
|
res.add("ResearchDefinition");
|
||||||
res.add("ResearchElementDefinition");
|
res.add("ResearchElementDefinition");
|
||||||
res.add("SearchParameter");
|
res.add("SearchParameter");
|
||||||
|
res.add("SpecimenDefinition");
|
||||||
res.add("StructureDefinition");
|
res.add("StructureDefinition");
|
||||||
res.add("StructureMap");
|
res.add("StructureMap");
|
||||||
res.add("SubscriptionTopic");
|
res.add("SubscriptionTopic");
|
||||||
|
@ -489,11 +490,12 @@ public class VersionUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isR5Ver(version) || "current".equals(version)) {
|
if (isR5Ver(version) || "current".equals(version)) {
|
||||||
|
res.add("ActorDefinition");
|
||||||
res.add("ActivityDefinition");
|
res.add("ActivityDefinition");
|
||||||
res.add("CapabilityStatement");
|
res.add("CapabilityStatement");
|
||||||
res.add("ChargeItemDefinition");
|
res.add("ChargeItemDefinition");
|
||||||
res.add("Citation");
|
res.add("Citation");
|
||||||
|
res.add("ClinicalUseDefinition");
|
||||||
res.add("CodeSystem");
|
res.add("CodeSystem");
|
||||||
res.add("CompartmentDefinition");
|
res.add("CompartmentDefinition");
|
||||||
res.add("ConceptMap");
|
res.add("ConceptMap");
|
||||||
|
@ -509,12 +511,16 @@ public class VersionUtilities {
|
||||||
res.add("Measure");
|
res.add("Measure");
|
||||||
res.add("MessageDefinition");
|
res.add("MessageDefinition");
|
||||||
res.add("NamingSystem");
|
res.add("NamingSystem");
|
||||||
|
res.add("ObservationDefinition");
|
||||||
res.add("OperationDefinition");
|
res.add("OperationDefinition");
|
||||||
res.add("PlanDefinition");
|
res.add("PlanDefinition");
|
||||||
res.add("Questionnaire");
|
res.add("Questionnaire");
|
||||||
|
res.add("Requirements");
|
||||||
res.add("SearchParameter");
|
res.add("SearchParameter");
|
||||||
|
res.add("SpecimenDefinition");
|
||||||
res.add("StructureDefinition");
|
res.add("StructureDefinition");
|
||||||
res.add("StructureMap");
|
res.add("StructureMap");
|
||||||
|
res.add("SubscriptionTopic");
|
||||||
res.add("TerminologyCapabilities");
|
res.add("TerminologyCapabilities");
|
||||||
res.add("TestScript");
|
res.add("TestScript");
|
||||||
res.add("ValueSet");
|
res.add("ValueSet");
|
||||||
|
|
|
@ -30,9 +30,9 @@ Bundle_Document_Date_Missing = A document must have a date (Bundle.timestamp)
|
||||||
Bundle_Document_Date_Missing_html = [(type = ''document'') implies (meta.lastUpdated.hasValue())]
|
Bundle_Document_Date_Missing_html = [(type = ''document'') implies (meta.lastUpdated.hasValue())]
|
||||||
CapabalityStatement_CS_SP_WrongType = Type mismatch - SearchParameter ''{0}'' type is {1}, but type here is {2}
|
CapabalityStatement_CS_SP_WrongType = Type mismatch - SearchParameter ''{0}'' type is {1}, but type here is {2}
|
||||||
CodeSystem_CS_VS_IncludeDetails = CodeSystem {0} has an ''all system'' value set of {1}, but the include has extra details
|
CodeSystem_CS_VS_IncludeDetails = CodeSystem {0} has an ''all system'' value set of {1}, but the include has extra details
|
||||||
CodeSystem_CS_VS_Invalid = CodeSystem {0} has an ''all system'' value set of {1}, but doesn''t have a single include
|
CodeSystem_CS_VS_Invalid = CodeSystem {0} has an ''all system'' value set of {1}, but the value set doesn''t have a single include
|
||||||
CODESYSTEM_CS_VS_EXP_MISMATCH = CodeSystem {0} has an ''all system'' value set of {1}, but it is an expansion with the wrong number of concepts (found {2}, expected {3})
|
CODESYSTEM_CS_VS_EXP_MISMATCH = CodeSystem {0} has an ''all system'' value set of {1}, but it is an expansion with the wrong number of concepts (found {2}, expected {3})
|
||||||
CodeSystem_CS_VS_WrongSystem = CodeSystem {0} has an ''all system'' value set of {1}, but doesn''t have a matching system ({2})
|
CodeSystem_CS_VS_WrongSystem = CodeSystem {0} has an ''all system'' value set of {1}, but the value set doesn''t have a matching system ({2})
|
||||||
Extension_EXTP_Context_Wrong = The extension {0} is not allowed to be used at this point (allowed = {1}; this element is {2})
|
Extension_EXTP_Context_Wrong = The extension {0} is not allowed to be used at this point (allowed = {1}; this element is {2})
|
||||||
Extension_EXTM_Context_Wrong = The modifier extension {0} is not allowed to be used at this point (allowed = {1}; this element is {2})
|
Extension_EXTM_Context_Wrong = The modifier extension {0} is not allowed to be used at this point (allowed = {1}; this element is {2})
|
||||||
Extension_EXT_Count_Mismatch = Extensions count mismatch: expected {0} but found {1}
|
Extension_EXT_Count_Mismatch = Extensions count mismatch: expected {0} but found {1}
|
||||||
|
|
|
@ -2028,10 +2028,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (definition.hasUserData(XVerExtensionManager.XVER_EXT_MARKER)) {
|
if (definition.hasUserData(XVerExtensionManager.XVER_EXT_MARKER)) {
|
||||||
warning(errors, NO_RULE_DATE, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false,
|
warning(errors, NO_RULE_DATE, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false,
|
||||||
modifier ? I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG_XVER : I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG_XVER, extUrl, contexts.toString(), plist.toString());
|
modifier ? I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG_XVER : I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG_XVER, extUrl, contexts.toString(), plist.toString());
|
||||||
} else {
|
} else {
|
||||||
rule(errors, NO_RULE_DATE, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false,
|
rule(errors, NO_RULE_DATE, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false,
|
||||||
modifier ? I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG : I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG, extUrl, contexts.toString(), plist.toString());
|
modifier ? I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG : I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG, extUrl, contexts.toString(), plist.toString());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4038,7 +4038,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rr.setFocus(res.getMatch());
|
rr.setFocus(res.getMatch());
|
||||||
rr.setExternal(false);
|
rr.setExternal(false);
|
||||||
rr.setStack(nstack.push(res.getMatch(), res.getIndex(), res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
rr.setStack(nstack.push(res.getMatch(), res.getIndex(), res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
||||||
rr.getStack().qualifyPath(".ofType("+nstack.getElement().fhirType()+")");
|
rr.getStack().pathComment(nstack.getElement().fhirType()+"/"+stack.getElement().getIdBase());
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4057,7 +4057,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rr.setFocus(e);
|
rr.setFocus(e);
|
||||||
rr.setExternal(false);
|
rr.setExternal(false);
|
||||||
rr.setStack(stack.push(e, -1, e.getProperty().getDefinition(), e.getProperty().getDefinition()));
|
rr.setStack(stack.push(e, -1, e.getProperty().getDefinition(), e.getProperty().getDefinition()));
|
||||||
rr.getStack().qualifyPath(".ofType("+e.fhirType()+")");
|
rr.getStack().pathComment(e.fhirType()+"/"+e.getIdBase());
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
e = e.getParentForValidator();
|
e = e.getParentForValidator();
|
||||||
|
@ -4089,7 +4089,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rr.setStack(stack.push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(),
|
rr.setStack(stack.push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(),
|
||||||
res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1,
|
res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1,
|
||||||
res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
||||||
rr.getStack().qualifyPath(".ofType("+rr.getResource().fhirType()+")");
|
rr.getStack().pathComment(rr.getResource().fhirType()+"/"+rr.getResource().getIdBase());
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4101,7 +4101,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rr.setFocus(tgt.getElement());
|
rr.setFocus(tgt.getElement());
|
||||||
rr.setExternal(false);
|
rr.setExternal(false);
|
||||||
rr.setStack(tgt);
|
rr.setStack(tgt);
|
||||||
rr.getStack().qualifyPath(".ofType("+tgt.getElement().fhirType()+")");
|
rr.getStack().pathComment(tgt.getElement().fhirType()+"/"+tgt.getElement().getIdBase());
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4123,7 +4123,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rr.setStack(new NodeStack(context, null, rootResource, validationLanguage).push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(),
|
rr.setStack(new NodeStack(context, null, rootResource, validationLanguage).push(res.getEntry(), res.getIndex(), res.getEntry().getProperty().getDefinition(),
|
||||||
res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1,
|
res.getEntry().getProperty().getDefinition()).push(res.getMatch(), -1,
|
||||||
res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
res.getMatch().getProperty().getDefinition(), res.getMatch().getProperty().getDefinition()));
|
||||||
rr.getStack().qualifyPath(".ofType("+rr.getResource().fhirType()+")");
|
rr.getStack().pathComment(rr.getResource().fhirType()+"/"+rr.getResource().getIdBase());
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5121,7 +5121,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.qualifyPath(".ofType("+resourceName+")");
|
stack.pathComment(resourceName+"/"+element.getIdBase());
|
||||||
|
|
||||||
if (typeForResource == null) {
|
if (typeForResource == null) {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(),
|
ok = rule(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(),
|
||||||
|
|
|
@ -154,6 +154,10 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
List<Element> types = element.getChildrenByName("type");
|
List<Element> types = element.getChildrenByName("type");
|
||||||
Set<String> typeCodes = new HashSet<>();
|
Set<String> typeCodes = new HashSet<>();
|
||||||
Set<String> characteristics = new HashSet<>();
|
Set<String> characteristics = new HashSet<>();
|
||||||
|
if (!path.contains(".")) {
|
||||||
|
typeCodes.add(path); // root is type
|
||||||
|
addCharacteristics(characteristics, path);
|
||||||
|
}
|
||||||
|
|
||||||
for (Element type : types) {
|
for (Element type : types) {
|
||||||
if (hasMustSupportExtension(type)) {
|
if (hasMustSupportExtension(type)) {
|
||||||
|
@ -373,7 +377,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
StructureDefinition sd = context.fetchTypeDefinition(tc);
|
StructureDefinition sd = context.fetchTypeDefinition(tc);
|
||||||
if (sd != null) {
|
while (sd != null) {
|
||||||
if (sd.hasExtension(ToolingExtensions.EXT_BINDING_STYLE)) {
|
if (sd.hasExtension(ToolingExtensions.EXT_BINDING_STYLE)) {
|
||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
|
@ -382,6 +386,10 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Utilities.existsInList(sd.getType(), "string", "uri", "CodeableConcept", "Quantity", "CodeableReference")) {
|
||||||
|
return tc;
|
||||||
|
}
|
||||||
|
sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -561,7 +569,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
} else if (!VersionUtilities.isR5Ver(context.getVersion())) {
|
} else if (!VersionUtilities.isR5Ver(context.getVersion())) {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()) || "Resource".equals(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()) || "Resource".equals(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
||||||
} else {
|
} else {
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), "CanonicalResource".equals(t.getType()) || VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, stack.getLiteralPath(), Utilities.existsInList(t.getType(), "Resource", "CanonicalResource") || VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(t.getType()), I18nConstants.SD_ED_TYPE_PROFILE_WRONG_TARGET, p, t, code, path, "Canonical Resource") && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -177,8 +177,8 @@ public class NodeStack {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void qualifyPath(String qualifier) {
|
public void pathComment(String comment) {
|
||||||
literalPath = literalPath + qualifier;
|
literalPath = literalPath + "/*"+comment+"*/";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -469,6 +469,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
||||||
if (fails.size() > 0) {
|
if (fails.size() > 0) {
|
||||||
logOutput("");
|
logOutput("");
|
||||||
logOutput("========================================================");
|
logOutput("========================================================");
|
||||||
|
logOutput("Test: "+name);
|
||||||
logOutput("");
|
logOutput("");
|
||||||
for (String s : fails) {
|
for (String s : fails) {
|
||||||
logOutput(s);
|
logOutput(s);
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<hapi_fhir_version>6.2.1</hapi_fhir_version>
|
<hapi_fhir_version>6.2.1</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.2.11</validator_test_case_version>
|
<validator_test_case_version>1.2.12-SNAPSHOT</validator_test_case_version>
|
||||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||||
|
|
Loading…
Reference in New Issue