-
Notifications
You must be signed in to change notification settings - Fork 531
Fix nested message object in API responses #12097
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
base: develop
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
pdurbin
left a comment
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.
A couple quick comments.
Also, @poikilotherm noticed this double message bug, which lead to this API v2 proposal: https://docs.google.com/document/d/1XtXPF_PZCuhPbm4HCu28yRge_4_--ah604NhigPdjPk/edit?usp=sharing . And these related issues:
| - `PUT /api/harvest/clients/{nickName}` | ||
| - `PUT /api/harvest/server/oaisets/{specname}` | ||
|
|
||
| **Note:** If you implemented a workaround to handle the nested `message` object, you may need to update your code to expect a plain string instead. |
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.
@ErykKul please also put this information in doc/sphinx-guides/source/api/changelog.rst
| .add("message", msg) | ||
| .add("data", bld).build()) | ||
| .type(MediaType.APPLICATION_JSON) | ||
| .build(); |
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'll just note here that Jenkins tests are failing due to this change. Please fix them. Thanks!
|
@pdurbin Thanks for the quick review and the context about the API v2 proposal! I was a bit hesitant to make this change since it could break existing API consumers that have implemented workarounds for the nested message object. However, I think it's worth fixing. The current behavior is clearly a bug, and the affected endpoints are relatively niche (the bug was actually discovered through duplicate file uploads, while regular file additions work fine). That said, I can see the argument for keeping this for API v2 if you think the breaking change risk is too high. Let me know your thoughts - happy to go either way. I've fixed the integration tests and added the changelog entry as requested. The docs build should pass now too (had a small RST syntax issue with the reference). |
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
What this PR does / why we need it:
Fixes the
ok(String msg, JsonObjectBuilder bld)method inAbstractApiBean.javawhich incorrectly wraps the message in a nested object:The bug was introduced in commit f311312c34 on May 12, 2020, as part of #4813.
Which issue(s) this PR closes:
Special notes for your reviewer:
This is a one-line fix in
AbstractApiBean.javaline 1000:The following 7 API endpoints are affected:
Datasets.javaPOST /api/datasets/{id}/add(duplicate file warning)Admin.javaPUT /api/admin/settingsDataverses.javaPUT /api/dataverses/{id}Dataverses.javaPUT /api/dataverses/{id}/inputLevelsSavedSearches.javaPOST /api/admin/savedsearchesHarvestingClients.javaPUT /api/harvest/clients/{nickName}HarvestingServer.javaPUT /api/harvest/server/oaisets/{specname}Suggestions on how to test this:
messagefield is a string, not a nested object:Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No
Is there a release notes update needed for this change?:
Yes, included in this PR:
doc/release-notes/12096-fix-ok-message-nested-object.mdAdditional documentation:
N/A