hapifhir / hapi-fhir

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

Hapi shouldn't throw an exception if validation fails #3611

Open patrick-werner opened 2 years ago

patrick-werner commented 2 years ago

Problem: In BaseHapiFhirResourceDao a PreconditionFailedException is thrown if the Validator returns Errors or Fatal Issues.

Expected behaviour: The OperationOutcome is returned, no Exception is thrown. 4xx or 5xx status codes are should only be returned if the validation itself fails: "This operation returns a 200 OK whether or not the resource is valid. A 4xx or 5xx error means that the validation itself could not be performed, and it is unknown whether the resource is valid or not."

tadgh commented 2 years ago

Are you working on this one patrick? Just want to check before I open a branch for it.

jamesagnew commented 2 years ago

Oh interesting.. this is a change from how it used to work. Agree with your assessment Patrick, we are doing the wrong thing now.

patrick-werner commented 2 years ago

Are you working on this one patrick? Just want to check before I open a branch for it.

no. Just reported it. I checked with 6.0.1: hapi still reports 412 on validation errors.

patrick-werner commented 2 years ago

I have to deprecate my last comment, having some spare time travelling by train. Fixing right now. Will create PR later