Allow valdation of string values in openchoice (#81)

This commit is contained in:
James Agnew 2019-09-16 16:04:46 -04:00 committed by GitHub
parent 840c45c2da
commit c6cbf7d7a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions

View File

@ -3608,18 +3608,20 @@ private boolean isAnswerRequirementFulfilled(QuestionnaireItemComponent qItem, L
// If it's the wrong type, just keep going // If it's the wrong type, just keep going
} }
} }
if (list.isEmpty() && !openChoice) { if (!openChoice) {
rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type string"); if (list.isEmpty()) {
} else { rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type string");
boolean found = false; } else {
for (StringType item : list) { boolean found = false;
if (item.getValue().equals((v.primitiveValue()))) { for (StringType item : list) {
found = true; if (item.getValue().equals((v.primitiveValue()))) {
break; found = true;
break;
}
}
if (!found) {
rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The string " + v.primitiveValue() + " is not a valid option");
} }
}
if (!found) {
rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The string "+v.primitiveValue()+" is not a valid option");
} }
} }
} else { } else {