hapifhir / hapi-fhir

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

Delete operation returning incorrect response when the resource does not exist #3411

Open rogtrifork opened 2 years ago

rogtrifork commented 2 years ago

Describe the bug Delete operation returning successful delete operation response even though the resource does not exist on the server.

To Reproduce


Alternatively, this can also be achieved through a GUI:

  1. Go to https://hapi.fhir.org
  2. Click on Patient (or any resource you like)
  3. In the Search Parameters field select _id and enter a random id in the Code (9999999), ensure that the response returns an empty bundle
  4. Navigate back to the the resource and navigate to CRUD Operations
  5. In the ID field of the Delete section enter the same id from step 3
  6. Click "Delete"

Expected behavior If a Delete operation is executed with an ID that does not exist, throw a ResourceNotFoundException

Screenshots image

Environment (please complete the following information):

Additional context The deletion does actually work. When the resource actually exists, it is deleted, it's just that when it doesn't exist it still tells you that a resource was deleted

christianderrico commented 2 months ago

I tried to repeat the operations and now the output message is: HAPI-0928: Failed to parse database resource[Patient/9999999 (pid 9999999, version R4): HAPI-1814: Incorrect resource type found, expected "Patient" but found "Observation"