Closed ruscoder closed 5 months ago
The open question is how it should work in case one of the expressions resolves as empty array.
There're three possible solutions:
/Patient/null/_history/null
Patient//_history/
- I really don't like it, because it leads to some issues while using in GET /Patient?_id={{ id }}
{{ '/Patient/' + id }}
turns into null
@ir4y please share your thoughts
In case when expression
resulted in the empty collection {}
:
{{- expression -}}
- the value of the expression should be undefined
{{ expression }}
- the value of the expression should be null
I reverted the behavior of {{ }}
to be backward compatible with the previous implementation. There's a flag called dropNulls
that is passed for /parse-template
and /r4/parse-templates
endpoints.
For /aidbox/parse-template
this flag is not passed.
In my opinion, if a key is specified it should be set to null instead of implicitly dropping. But there's an issue with FHIR union types, e.g. valueBoolean: null
is a wrong notation, while value: null
in Aidbox works fine.
It looks like there's a bug in Aidbox /fhir implementation,
POST /fhir/Patient
deceasedBoolean: null
fails with
resourceType: OperationOutcome
text:
status: generated
div: Invalid resource
issue:
- severity: fatal
code: invalid
expression:
- Patient.deceased.boolean
diagnostics: Expected type of 'boolean, got 'nil
We had a discussion with @ir4y and decided to leave the behavior of dropping nullable keys by default.
And instead of {{- -}}
we added explicit preserve-null construction: {{+ expr +}}
- in case if expr
returns an empty collection, null will be preserved.
Moreover, if
directive also drops key in case when else
branch is not specified, to explicitly return null, {% else %}: null
or {% else %}: {{+ {} +}}
are needed to be passed, the second one is empty collection
Currently string might be constructed using only one expression in curly braces, e.g.
Patient/{{ id }}
.It will be good to have this behaviour extended to using multiple fhirpath expressions, e.g.
Patient/{{ id }}/_history/{{ hid }}
.