-
Notifications
You must be signed in to change notification settings - Fork 95
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
CMR-9848: When submitting multiple associations, if one fails CMR returns a 400 but still makes the other associations #2198
base: master
Are you sure you want to change the base?
Conversation
…sitory into CMR-9848-Association-Status
…sitory into CMR-9848-Association-Status
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2198 +/- ##
==========================================
+ Coverage 58.23% 58.27% +0.04%
==========================================
Files 1056 1056
Lines 71012 71075 +63
Branches 2023 2029 +6
==========================================
+ Hits 41351 41417 +66
+ Misses 27772 27763 -9
- Partials 1889 1895 +6 ☔ View full report in Codecov by Sentry. |
:headers {"Content-Type" mt/json}})) | ||
(if (= 207 status-code) | ||
{:status status-code | ||
:body (json/generate-string (util/snake-case-data (cmr.search.api.association/add-individual-statuses data))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmr.search.api.association, you simplify by adding path to imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my how did that get in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we were under different dictatorships I would say this should be fine for a one off, but alas the overlords must be appeased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -98,3 +98,12 @@ | |||
:body | |||
first | |||
:tool-association))) | |||
|
|||
(defn add-individual-statuses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain why your creating atoms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping maybe someone knew a better way to do this. But essentially I am taking a list of maps and need to add an item into each map and return the changed list of maps. I did not know how to do this without using atoms in clojure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked off line, I would suggest that you take the recommended code with a grain of salt and proceed as you see best. I prefer that you do not introduce an atom, but if the code mentioned does not work or causes a delay then roll it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated atom funcs to remove atom -- AI for the win this time
Overview
What is the problem?
When some associations in POST request, fail, but some succeed. The response returns a 400 for association endpoints, but we want it to reflect the true state that some associations failed.
What is the Solution?
If a request with multiple associations returns with some successes and some failures, we will return a 207 MULT-STATUS instead, with each association having its own status of 200 or 400 based on success or failure.
Associations affected:
New Expected Response Status Behavior:
What areas of the application does this impact?
Search App
Checklist