Stream: questionnaire
Topic: Validation of Questionnaire resources
David Winters (Feb 12 2020 at 19:50):
Anyone actively using the FHIR Validator on Questionnaire resources? I've run into an issue where the validator chokes when multiple enableWhen elements are included in a single item. The problem I'm seeing is probably best illustrated with an example. If I take an example Questionnaire and run the validator it passes with some expected (and some unexpected) warnings. If I update the example JSON so that the item with linkId=4 includes more than one enableWhen:
"enableWhen": [
{
"question": "1",
"operator": "=",
"answerBoolean": false
},
{
"question": "2",
"operator": "=",
"answerBoolean": false
}
],
"enableBehavior": "all"
I get the following error:
>> java -jar org.hl7.fhir.validator.jar example.json -version 4.0 -ig hl7.fhir.uv.sdc
FHIR Validation tool Version 4.1.61-SNAPSHOT (Git# b6ba504320f6). Built 2020-02-07T10:55:33.966+11:00 (5 days old)
.. FHIR Version 4.0, definitions from hl7.fhir.r4.core#4.0.1
.. connect to tx server @ http://tx.fhir.org
(v4.0.1)
+ .. load IG from hl7.fhir.uv.sdc
... Using version 2.7.0
.. validate [example.json]
Exception in thread "main" java.lang.Error: Attempt to read a single element when there is more than one present (enableWhen)
Wondering if this is a bug in the validator or if I'm misunderstanding how to define multiple enableWhen conditions.
Lloyd McKenzie (Feb 12 2020 at 20:32):
That sounds like a validator bug. enableWhen has been allowed to repeat since it was introduced in STU3. @Grahame Grieve
Grahame Grieve (Feb 12 2020 at 20:43):
I've just stumbled into a pile of bugs here. So much for test cases
David Winters (Feb 12 2020 at 20:52):
Thanks @Grahame Grieve , thanks @Lloyd McKenzie . It's good to get confirmation that my thinking was not way out of line. Let me know if you need any further information.
David Winters (Feb 13 2020 at 13:19):
Thanks @Grahame Grieve , confirming this issue is fixed in the latest version of the validator (4.1.63).
Last updated: Apr 12 2022 at 19:14 UTC