fhirbase/fhirbase-plv8

Resolving references in transaction bundle is sensitive to order of entry elements.

ratp0is0n opened this issue · 2 comments

Tested on v1.3.0.25

for example after SELECT fhir_transaction with json incorrect bundle request.txt

I recived response incorrect bundle response.txt with unresolved reference
"detail": [{ "reference": "urn:uuid:4f6a30fb-cd3c-4ab6-8757-532101f72067" }]
in Order resource.

If I change resource order from [Order, DiagnosticOrder] to [DiagnosticOrder, Order]
like in this example correct bundle request.txt, reference is resolved correctly
"detail": [{ "reference": "/DiagnosticOrder/4ce9a9a6-841d-410d-aa8b-1d6549ccf8f5"}] correct bundle response.txt

Correct, resources in transaction should be ordered topologically to make transaction code correctly resolve local references in CREATE and UPDATE operations. Circular references also won't work.

Ok, thanks!