Skip to content
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-10186: Handling case when collections query parameter is a comma separated string #357

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

william-valencia
Copy link
Contributor

CMR-STAC was passing the collections query parameter as is to graphQL which resulting in a comma separated string as an entryID, ie: "entryId": [ "HLSS30_2.0,HLSL30_2.0" ]. In this case CMR-STAC would return nothing.
This needs to be split properly so that the field passed the graphQL would be of the form "entryId": [ "HLSS30_2.0", "HLSL30_2.0" ]

Example GET Requests:
https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?collections=HLSS30_2.0,HLSL30_2.0
http://localhost:3000/stac/LPCLOUD/search?collections=HLSS30_2.0,HLSL30_2.0

Specifying multiple collections in this manner should return the proper results

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.36%. Comparing base (2449123) to head (1875fee).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #357      +/-   ##
==========================================
+ Coverage   88.34%   88.36%   +0.01%     
==========================================
  Files          24       24              
  Lines        1167     1169       +2     
  Branches      256      257       +1     
==========================================
+ Hits         1031     1033       +2     
  Misses        136      136              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@macrouch
Copy link
Contributor

macrouch commented Oct 9, 2024

Is it possible for the list of entry IDs to have a space after the comma? Instead of coll_v1,coll_v2, could it come in as coll_v1, coll_v2?

If so, does the code correctly handle that?

@william-valencia
Copy link
Contributor Author

william-valencia commented Oct 9, 2024

Is it possible for the list of entry IDs to have a space after the comma? Instead of coll_v1,coll_v2, could it come in as coll_v1, coll_v2?

If so, does the code correctly handle that?

The STAC spec says their should be no whitespaces between values.
https://github.com/radiantearth/stac-api-spec/tree/release/v1.0.0/item-search#query-parameters-and-fields

@william-valencia william-valencia merged commit a8db4bf into master Oct 9, 2024
5 checks passed
@macrouch macrouch deleted the CMR-10186 branch October 10, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants