Skip to content

Specify the sorting of resource listings#224

Open
j616 wants to merge 4 commits into
mainfrom
jamessa-listingsSort
Open

Specify the sorting of resource listings#224
j616 wants to merge 4 commits into
mainfrom
jamessa-listingsSort

Conversation

@j616

@j616 j616 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Details

TAMS hasn't previously specified how resource listings should be sorted. This PR includes an ADR on options for how resource listings should be sorted.

Issue (if relevant)

GitHub Issue: #189
Jira: https://jira.dev.bbc.co.uk/browse/CLOUDFIT-5486

Related PRs

Submitter PR Checks

  • PR completes task/fixes bug
  • API version has been incremented if necessary
  • ADR status has been updated, and ADR implementation has been recorded
  • Documentation updated (README, etc.)
  • PR added to Jira Issue (if relevant)
  • Follow-up stories added to Jira

Reviewer PR Checks

  • PR completes task/fixes bug
  • Design makes sense, and fits with our current code base
  • Code is easy to follow
  • PR size is sensible
  • Commit history is sensible and tidy

Info on PRs

The checks above are guidelines. They don't all have to be ticked, but they should all have been considered.

@j616 j616 force-pushed the jamessa-listingsSort branch 2 times, most recently from 7f2dc80 to 5c82420 Compare July 13, 2026 10:04
@j616 j616 marked this pull request as ready for review July 13, 2026 10:04
@j616 j616 requested a review from a team as a code owner July 13, 2026 10:04

@samdbmg samdbmg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall - couple of thoughts inlined

Comment thread docs/adr/0052-sort-listings.md Outdated
Comment thread docs/adr/0052-sort-listings.md Outdated
All endpoints will have a `reverse_order` query parameter, matching that which currently exists on the `/flows/{flowId}/segments` endpoint.

Datetime keys shall be sorted newest-first by default.
String keys shall be sorted ascending alphabetically by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify (or preferably, cite) a lexicographical ordering to avoid uncertainty for casing and numbers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this out because I think lexographical can often result in lower case being grouped and upper case being grouped, if I'm not mistaken. At least, how they are defined in programming languages differs. With the likes of Python requiring you to go as far a key such as sorted("This is a test string".split(), key=str.casefold) which may be just as un-clear in terms of how numbers/none alpha-numeric chars are handled. I felt stating "alphabetically" better conveyed sorting such that a is next to A without having to dig into the peculiarities of languages.

@j616 j616 linked an issue Jul 14, 2026 that may be closed by this pull request
2 tasks
j616 and others added 2 commits July 14, 2026 15:25
Co-authored-by: Sam Mesterton-Gibbons <sam.mesterton-gibbons@bbc.co.uk>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the X-Paging-Reverse-Order header too to be consistent with the Segments endpoint?

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.

Add the ability to sort Flow/Source listings

3 participants