fix return paths when validating codes
This commit is contained in:
parent
3cb9c195a0
commit
57d1a973e4
|
@ -913,7 +913,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
public ValidationResult validateCode(ValidationOptions options, String system, String version, String code, String display, ValueSet vs) {
|
||||
assert options != null;
|
||||
Coding c = new Coding(system, version, code, display);
|
||||
return validateCode(options, "code", c, vs);
|
||||
ValidationResult ret = validateCode(options, "$", c, vs);
|
||||
ret.trimPath("$");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -323,6 +323,22 @@ public interface IWorkerContext {
|
|||
|
||||
}
|
||||
|
||||
public void trimPath(String prefix) {
|
||||
if (issues != null) {
|
||||
for (OperationOutcomeIssueComponent iss : issues) {
|
||||
for (int i = iss.getLocation().size() -1; i >= 0; i--) {
|
||||
var s = iss.getLocation().get(i).primitiveValue();
|
||||
if (prefix.equals(s)) {
|
||||
iss.getLocation().remove(i);
|
||||
} else if (s.startsWith(prefix+".")) {
|
||||
iss.getLocation().get(i).setValueAsString(s.substring(prefix.length()+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CodingValidationRequest {
|
||||
|
|
Loading…
Reference in New Issue