More bug fixes validating FML
This commit is contained in:
parent
eb852a8d03
commit
09648b7ea0
|
@ -111,6 +111,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
|||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
|
||||
import org.hl7.fhir.r5.model.ExpressionNode;
|
||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
||||
import org.hl7.fhir.r5.model.Extension;
|
||||
import org.hl7.fhir.r5.model.HumanName;
|
||||
import org.hl7.fhir.r5.model.Identifier;
|
||||
|
@ -191,6 +192,8 @@ import org.hl7.fhir.validation.instance.type.QuestionnaireValidator;
|
|||
import org.hl7.fhir.validation.instance.type.SearchParameterValidator;
|
||||
import org.hl7.fhir.validation.instance.type.StructureDefinitionValidator;
|
||||
import org.hl7.fhir.validation.instance.type.StructureMapValidator;
|
||||
import org.hl7.fhir.validation.instance.type.StructureMapValidator.VariableDefn;
|
||||
import org.hl7.fhir.validation.instance.type.StructureMapValidator.VariableSet;
|
||||
import org.hl7.fhir.validation.instance.type.ValueSetValidator;
|
||||
import org.hl7.fhir.validation.instance.utils.ChildIterator;
|
||||
import org.hl7.fhir.validation.instance.utils.ElementInfo;
|
||||
|
@ -270,6 +273,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
@Override
|
||||
public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException {
|
||||
if (appContext instanceof VariableSet) {
|
||||
VariableSet vars = (VariableSet) appContext;
|
||||
VariableDefn v = vars.getVariable(name.substring(1));
|
||||
if (v != null && v.hasTypeInfo()) {
|
||||
return new TypeDetails(CollectionStatus.SINGLETON, v.getWorkingType());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ValidatorHostContext c = (ValidatorHostContext) appContext;
|
||||
if (externalHostServices != null)
|
||||
return externalHostServices.resolveConstantType(c.getAppContext(), name);
|
||||
|
|
|
@ -170,8 +170,12 @@ public class StructureMapValidator extends BaseValidator {
|
|||
}
|
||||
return type;
|
||||
}
|
||||
if (ed != null && ed.getType().size() == 1) {
|
||||
return ed.getType().get(0).getWorkingCode();
|
||||
if (ed != null) {
|
||||
if (!ed.getPath().contains(".")) {
|
||||
return ed.getPath();
|
||||
} else if (ed.getType().size() == 1) {
|
||||
return ed.getType().get(0).getWorkingCode();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -245,6 +249,16 @@ public class StructureMapValidator extends BaseValidator {
|
|||
return null;
|
||||
}
|
||||
|
||||
public VariableDefn getVariable(String name) {
|
||||
VariableDefn t = null;
|
||||
for (VariableDefn v : list) {
|
||||
if (name.equals(v.getName())) {
|
||||
t = (t == null) ? v : null;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public void add(String pname, VariableDefn v) {
|
||||
VariableDefn vn = v.copy();
|
||||
vn.name = pname;
|
||||
|
@ -321,7 +335,7 @@ public class StructureMapValidator extends BaseValidator {
|
|||
cc = 0;
|
||||
for (Element group : groups) {
|
||||
if (!group.hasUserData("structuremap.validated")) {
|
||||
hint(errors, "2023-03-01", IssueType.INFORMATIONAL, group.line(), group.col(), stack.push(group, cc, null, null).getLiteralPath(), ok, I18nConstants.SM_ORPHAN_GROUP, group.getName());
|
||||
hint(errors, "2023-03-01", IssueType.INFORMATIONAL, group.line(), group.col(), stack.push(group, cc, null, null).getLiteralPath(), ok, I18nConstants.SM_ORPHAN_GROUP, group.getChildValue("name"));
|
||||
ok = validateGroup(errors, src, group, stack.push(group, cc, null, null)) && ok;
|
||||
}
|
||||
cc++;
|
||||
|
@ -710,7 +724,7 @@ public class StructureMapValidator extends BaseValidator {
|
|||
String exp = params.get(0).getChildValue("value");
|
||||
if (rule(errors, "2023-03-01", IssueType.INVALID, params.get(0).line(), params.get(0).col(), stack.getLiteralPath(), exp != null, I18nConstants.SM_TARGET_TRANSFORM_PARAM_UNPROCESSIBLE, "0", params.size())) {
|
||||
try {
|
||||
TypeDetails td = fpe.check(null, v.getSd().getType(), v.getEd().getPath(), fpe.parse(exp));
|
||||
TypeDetails td = fpe.check(variables, v.getSd().getType(), v.getEd().getPath(), fpe.parse(exp));
|
||||
if (td.getTypes().size() == 1) {
|
||||
type = td.getType();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue