hapifhir / hapi-fhir

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

Binary resource isn't returning generated ID after POST #2906

Open gregory-akins opened 2 years ago

gregory-akins commented 2 years ago

NOTE: Before filing a ticket, please see the following URL: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help

Describe the bug When creating a Binary resource in HAPI FHIR server, the returned resource has the same ID as provided, rather than a new generated ID. This is inconsistent with the behavior of other resources in HAPI FHIR.

To Reproduce Steps to reproduce the behavior:

  1. run the latest HAPI-FHIR-JPASERVER-starter docker image
  2. POST to http://localhost:8080/fhir/binary the body { "resourceType": "Binary", "id": "example", "contentType": "application/pdf", "securityContext": { "reference": "DocumentReference/example" }, "data": "encoded data snipped for brevity" }
  3. Example response object has a body which includes ID=example instead of the generated ID

Expected behavior In this case, I would expect the response body to include the ID generated by PostgresSQL as occurs with other FHIR resources.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

ilanl commented 2 years ago

I experienced the same on Hapi Server Org when I post a Patient with a given ID it's not returned with the specific ID

gregory-akins commented 2 years ago

That is by design, AFAIK

A Post creates a resource. HAPI Server removes the ID passed with the resource and assigns it a new ID (because it's a new Resource).

The behavior I experienced is the opposite. When I pass an ID on a Binary post, it is saved and returned in the response ( different than Patient, and the other resources I've implemented).

On Thu, Oct 21, 2021 at 7:21 AM Ilan Levy @.***> wrote:

I experienced the same on Hapi Server Org when I post a Patient with a given ID it's not returned with the specific ID

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hapifhir/hapi-fhir/issues/2906#issuecomment-948512814, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASLIC244YTBZNX4SPRZSJJTUH7ZUJANCNFSM5CQIVALA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.