-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature Request - Implement toggle to prevent conditional updates from invalidating match criteria. #5290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A couple things:
I recommend we do what the comment suggests, and add a toggle to control this behaviour for users who wish to prevent this. |
Thanks, @tadgh. Will update the ticket to treat as a feature request. Appreciate your help! |
@dmuylwyk this could be lateral to the feature main point but could be the subject of a new bug. in 2. you mentioned: Because no such resource exists in the repository, this is treated as a conditional create. However, according to the spec, a ccreate must include an |
Ah, let me clarify: this is logically treated as a conditional create. I believe we use the same code but I may be mistaken. The point is that a conditional update is a create when there is no match. Apologies for the confusion. I'll correct the description above. |
Describe the Feature Request
Note this was initially and incorrectly categorized as a bug; leaving steps to reproduce and expected behaviour to inform implementation.
Conditional updates are behaving inconsistently with respect to the supplied resource not satisfying the conditional URL. This is expected behaviour since technically it's legal to invalidate match criteria via conditional update. Refer to this comment in the code:
BaseHapiFhirDao#L1183-L1188
What's legal is not necessarily desirable so we need to introduce a new property that will when enabled prevent conditional updates from invalidating match criteria regardless of the resource version.
The default value for this property should be
false
to preserve existing behaviour.Note #5291 already includes a test harness for whichever developer eventually implements this.
Please refer to:
Steps to Reproduce
1. Create a new Patient, for example:
No issues here.
Screenshot
2. Attempt to conditionally update this Patient with an incorrect identifier.value in the conditional URL:
Because no such resource exists in the repository, this conditional update behaves as a create. It rightly fails as expected with an
HTTP 400
/HAPI-0929
during "conditional create validation", which is only applied for resource version 1 of a given resource.Screenshot
3. Attempt to conditionally update this Patient with an incorrect identifier.value in the body:
This succeeds but it I initially thought it shouldn't. Note the conditional URL and resource body no longer match; however, according to the specification it's perfectly legal to invalidate match criteria in this way. More specifically: nothing in the specification explicitly forbids this behaviour.
Screenshot
Expected Behaviour
When the new property to prevent conditional updates from invalidating match criteria is enabled, Step 3 above should also result in an
HTTP 400
/HAPI-0929
(or similar error). Essentially, conditional create validation should be applied to resource versions higher than 1.Environment
Tested locally with
6.9.4-SNAPSHOT
; see:The text was updated successfully, but these errors were encountered: