Experimental dataset JSON GET API returns multi-valued fields as arrays#12488
Open
stevenwinship wants to merge 2 commits into
Open
Experimental dataset JSON GET API returns multi-valued fields as arrays#12488stevenwinship wants to merge 2 commits into
stevenwinship wants to merge 2 commits into
Conversation
qqmyers
reviewed
Jun 25, 2026
| // Add metadata value to aggregation, suppress array when multiples not allowed | ||
| JsonArray valArray = vals.build(); | ||
| return (valArray.size() != 1) ? valArray : valArray.get(0); | ||
| return (dfType.isAllowMultiples()) ? valArray : valArray.get(0); |
Member
There was a problem hiding this comment.
If you make changes to the OREMap, you need to update the version as noted at
. This could also break archiving and tools such as DVUploader that can read archival bags to restore datasets. Hopefully those are robust enough to this change, but they presumably have code to parse single values that will now be obsolete.
Contributor
Author
There was a problem hiding this comment.
I will update the version (even though the output really doesn't change) and check DVUploader. DVUploader and anyone using the API should have no issue with the array since it is there when more than 1 entry is there.
This comment has been minimized.
This comment has been minimized.
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
Test Results403 tests 388 ✅ 33m 4s ⏱️ Results for commit 190d915. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it: For API GET /api/datasets/{id}/metadata multi-valued field values are not returned as arrays if only 1 entry exists. This causes parsing the JSON to be more complex.
Which issue(s) this PR closes: #9495
Special notes for your reviewer: Since the fields are parsed as an array, when more than 1 entry exists, there is no break in backward compatibility.
Suggestions on how to test this: Create a dataset with 1 subject and another with more than 1 subject. Examine the JSON output to see that the "subject": ["Medicine, Health and Life Sciences"] is always surrounded with []. This will happen for all fields that have DatasetFieldType.isAllowMultiples() (for reference "title" does not allow multiples)
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?: Included
Additional documentation: