GSA / GSA/data.gov

Harvest-API: `order_by` descending prefix (`-field`) is silently ignored on list endpoints

Open
#5,907 0 comments 0 reactions 0 assignees View on GitHub
API bug Harvester
Dominant language
Python
Stars
1.1k
Forks
200
Avg merge
4h 56m
Merged PRs (30d)
5

Description

**Description**
Using a minus prefix to request descending sort order (e.g. order_by=-name) returns the same results as ascending order with no indication the prefix was ignored.

**Steps to Reproduce**
GET https://harvest.data.gov/harvest_sources/?per_page=3&order_by=name GET https://harvest.data.gov/harvest_sources/?per_page=3&order_by=-name

**Expected Behavior**
Minus prefix returns results in descending order.

**Actual Behavior**
Both requests return identical results in the same order.

**Notes**
Confidence: MEDIUM -- tested on /harvest_sources/ with name field only. Needs testing with additional fields and endpoints to confirm the minus prefix is ignored generally.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.