Failed transaction response doesn't conform Bundle specification
Opened this issue · 5 comments
Hi!
Issue connected with #119, but my case is related to errors during transaction:
Trying to create resource of non-existing type:
fhirbase=# SELECT fhir_transaction('{"resourceType":"Bundle","type":"transaction","entry":[{"resource":{"resourceType":"UnknownResource","active":true,"name":[{"use":"official","family":["Snow"],"given":["John"]}],"gender":"male","birthDate":"2001-01-01"},"request":{"method":"POST","url":"UnknownResource"}}]}');
a response
fhir_transaction | {"resourceType":"Bundle","type":"transaction-response","entry":[{"resourceType":"OperationOutcome","text":{"div":"<div>Storage for UnknownResource not exists</div>"},"issue":[{"severity":"error","code":"not-supported"}]}]}
The response doesn't conform specification at: https://www.hl7.org/fhir/bundle-response.json.html
Tested on v.1.3.0.15
@draakhan according to FHIR documentation:
"For a failed transaction, the server returns a single OperationOutcome instead of a Bundle"
http://hl7-fhir.github.io/http.html#transaction-response
appropriate test here
if not, feel free to reopen
@danil It looks that single OperationOutcome is contrary to: http://hl7-fhir.github.io/bundle.html#transaction-response
Here is my next example for transaction with more than one operation:
fhirbase=# select fhir_transaction('{
fhirbase'# "resourceType": "Bundle",
fhirbase'# "type": "transaction",
fhirbase'# "entry": [
fhirbase'# {
fhirbase'# "resource": {
fhirbase'# "resourceType": "UnknownResource",
fhirbase'# "active": true,
fhirbase'# "name": [
fhirbase'# {
fhirbase'# "use": "official",
fhirbase'# "family": [
fhirbase'# "Snow"
fhirbase'# ],
fhirbase'# "given": [
fhirbase'# "John"
fhirbase'# ]
fhirbase'# }
fhirbase'# ],
fhirbase'# "gender": "male",
fhirbase'# "birthDate": "2001-01-01"
fhirbase'# },
fhirbase'# "request": {
fhirbase'# "method": "POST",
fhirbase'# "url": "UnknownResource"
fhirbase'# }
fhirbase'# },
fhirbase'# {
fhirbase'# "resource": {
fhirbase'# "resourceType": "Patient",
fhirbase'# "active": true,
fhirbase'# "name": [
fhirbase'# {
fhirbase'# "use": "official",
fhirbase'# "family": [
fhirbase'# "Snow"
fhirbase'# ],
fhirbase'# "given": [
fhirbase'# "John"
fhirbase'# ]
fhirbase'# }
fhirbase'# ],
fhirbase'# "gender": "male",
fhirbase'# "birthDate": "2001-01-01"
fhirbase'# },
fhirbase'# "request": {
fhirbase'# "method": "POST",
fhirbase'# "url": "Patient"
fhirbase'# }
fhirbase'# }
fhirbase'# ]
fhirbase'# }');
-[ RECORD 1 ]----+-------------------------------------------------------------------------------------------------------------------------------------------------
fhir_transaction | {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"not-supported","diagnostics":"Storage for UnknownResource not exists"}]}
It could be more useful for developing and supporting transaction when in case of error we'll have response for every operation in transaction.
@draakhan do you suggest to ignore http://hl7-fhir.github.io/http.html#transaction-response ?
Yes, I think about ignoring it and conforming only to http://hl7-fhir.github.io/bundle.html#transaction-response . On the other hand, a diagnostic message from OperationOutcome, if it is added to Bundle.entry.response for failed operations, it will be useful too.
Yes, I think about ignoring it and conforming only to
http://hl7-fhir.github.io/bundle.html#transaction-response .
i should first consult with team about this