hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.05k stars 1.34k forks source link

$document operation bundle in Hapi-Fhir does not comply with FHIR specifications regarding the use of total and entry.search elements #4713

Open Eernie opened 1 year ago

Eernie commented 1 year ago

Describe the bug The issue pertains to the $document operation bundle in the Hapi-Fhir project and concerns non-compliance with FHIR specifications. Specifically, the Bundle specification (section 2.36.3.2) outlines two constraints related to the use of the total and entry.search elements. According to constraint bdl-1, the total element should only be present when a search or history operation is performed. Constraint bdl-2 states that the entry.search element should only be present when a search operation is performed.

However, the current implementation of the $document operation bundle in Hapi-Fhir is not adhering to these constraints. The operation is returning both entry.search and bundle.total. This non-compliance with the FHIR specification is causing issues when the consumer of this $document operation had strict validation.

To Reproduce Steps to reproduce the behavior:

  1. Create a composition
  2. Run the $document operation

Expected behavior The bundle should not have a total and the entries should not have a search element

Environment (please complete the following information):

jmeinsma commented 1 year ago

Great, can someone apply this fix? I was just looking for exactly this issue, very nice Eernie that you fixed it!