Please describe your request
During tests, I found three issues related to pagination that need clarification on which behavior is intended vs should be fixed
Contract refs:
|
- `sort` - the criteria to use. Ordering is specified appending a comma and the keyword asc or desc to the criteria name (i.e. title,asc). Unknown sort criteria and/or ordering keyword produce an error response with Http Code `400` |
|
### Pagination Error Codes |
|
`400 Bad Request` - If an unknown sort criteria is requested, or a not valid ordering keyword is specified |
Claims:
- invalid sort field returns 400
- invalid sort direction returns 400
Issue 1 - invalid sort fields returns 422, not 400
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
| Parameter |
Return code |
| sort=dc.title,asc |
200 |
| sort=dc.date,asc |
422 |
| sort=doesnotexist,desc |
422 |
Issue 2 - invalid sort direction returns 200, not 400
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
| Parameter |
Return code |
| sort=dc.title,asc |
200 |
sort=dc.title,dsc (desc typo) |
200 |
| sort=dc.title,doesnotexist |
200 |
Issue 3 - the invalid direction is silently applied as ascending
Not covered by the contract
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
Tested via $ curl -s 'https://sandbox.dspace.org/server/api/discover/search/objects?sort=dc.title,desc' | jq -r '._embedded.searchResult._embedded.objects.[]._embedded.indexableObject.uuid' | head -3
| Parameter |
Return body (shortened to first part of UUID) |
| sort=dc.title,asc |
3329a278, fff7a10b, 51715dd3 |
| sort=dc.title,desc |
bd254afc, ab19b0a2, cda7a628 |
| sort=dc.title,dsc |
3329a278, fff7a10b, 51715dd3 |
| sort=dc.title,doesnotexist |
3329a278, fff7a10b, 51715dd3 |
UUIDs for both dsc, doesnotexist match asc
Please describe your request
During tests, I found three issues related to pagination that need clarification on which behavior is intended vs should be fixed
Contract refs:
RestContract/README.md
Line 143 in 54bcdf6
RestContract/README.md
Lines 189 to 190 in 54bcdf6
Claims:
Issue 1 - invalid sort fields returns 422, not 400
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
Issue 2 - invalid sort direction returns 200, not 400
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
desctypo)Issue 3 - the invalid direction is silently applied as ascending
Not covered by the contract
Base URL: https://sandbox.dspace.org/server/api/discover/search/objects
Tested via
$ curl -s 'https://sandbox.dspace.org/server/api/discover/search/objects?sort=dc.title,desc' | jq -r '._embedded.searchResult._embedded.objects.[]._embedded.indexableObject.uuid' | head -33329a278,fff7a10b,51715dd3bd254afc,ab19b0a2,cda7a6283329a278,fff7a10b,51715dd33329a278,fff7a10b,51715dd3UUIDs for both
dsc,doesnotexistmatchasc