Skip to content

Add optional sort_on parameter to @vocabularies#1990

Merged
davisagli merged 13 commits intoplone:mainfrom
hasansyed107:fix-vocabulary-ordering-1854
Feb 24, 2026
Merged

Add optional sort_on parameter to @vocabularies#1990
davisagli merged 13 commits intoplone:mainfrom
hasansyed107:fix-vocabulary-ordering-1854

Conversation

@hasansyed107
Copy link
Contributor

@hasansyed107 hasansyed107 commented Feb 20, 2026

Hey team! I've added a sort_on query parameter to the @vocabularies endpoint to allow for server-side sorting by either title or token.

Why this matters:
Previously, if you had a large vocabulary, you'd have to sort it on the frontend after batching, which led to inconsistent results. Now, we sort the terms before the batching happens.

How I built it:

I made sure the sorting logic exactly matches how terms are serialized. If a term doesn't have a title, it falls back to the token so the alphabetical list stays consistent.

Handled i18n translations and case-insensitivity so "Title" and "title" (or "Tötle") play nice together.

Added functional tests to cover these new cases without touching the existing 1,300+ tests.

Closes #1989. Thanks for taking a look!


📚 Documentation preview 📚: https://plonerestapi--1990.org.readthedocs.build/

@mister-roboto
Copy link

@hasansyed107 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@hasansyed107 hasansyed107 force-pushed the fix-vocabulary-ordering-1854 branch 3 times, most recently from 84fe109 to 2f89974 Compare February 20, 2026 16:36
Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

I'm okay with this feature, but:

  1. It's really frustrating that I have to spend time telling you to re-add comments and tests that were removed for no good reason. If you continue doing this, I will not review your PRs.
  2. Sorting on token makes no sense, it's an internal identifier not visible to the user
  3. The new option needs to be included in the documentation

@stevepiercy
Copy link
Contributor

@davisagli I'd close this PR, and even consider a temporary ban from the Plone GitHub organization per https://6.docs.plone.org/contributing/first-time.html#requirements to give the author the time they need to review that and reconsider their actions. We're volunteers, and such persistent, careless, and disrespectful behavior shouldn't be tolerated.

I've done exactly that in the Volto and Documentation repos a few times for similar behavior.

@hasansyed107 hasansyed107 force-pushed the fix-vocabulary-ordering-1854 branch from 277a958 to 5f306f4 Compare February 21, 2026 03:34
@hasansyed107
Copy link
Contributor Author

Hi @davisagli, thank you for the feedback.

You’re absolutely right — removing those comments and tests during iteration was a mistake on my part. I understand that review time is limited, and I apologize for the extra work this caused.

I’ve now:

  • Restored the original comments and tests.
  • Removed token sorting as suggested.
  • Updated the documentation accordingly.

All tests pass locally and CI checks are running.

Thanks again for the thorough review.

@hasansyed107
Copy link
Contributor Author

@jenkins-plone-org please run jobs

hasansyed107 and others added 3 commits February 21, 2026 20:13
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
@hasansyed107
Copy link
Contributor Author

I’ve resolved the merge conflict and rebased the branch to align with the latest changes.

The vocabulary sorting logic is now consistent with the serialized output, and the documentation includes the generated HTTP examples.

All tests are passing locally — happy to address any feedback.

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

Co-authored-by: Steve Piercy <web@stevepiercy.com>
@hasansyed107
Copy link
Contributor Author

@jenkins-plone-org please run jobs

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

Docs look good. Needs a final technical review.

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

Thanks for updating based on my earlier feedback. This looks quite good now, my new comments are just final cleanup.

@hasansyed107
Copy link
Contributor Author

@jenkins-plone-org please run jobs

@hasansyed107
Copy link
Contributor Author

Hi @davisagli, thanks for the suggestions. I’ve applied the requested cleanup changes

Co-authored-by: David Glick <david@glicksoftware.com>
Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

Thanks!

@davisagli davisagli merged commit 8a5e486 into plone:main Feb 24, 2026
8 of 10 checks passed
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.

Enhancement: Optional 'sort_on' parameter for @vocabularies endpoint

4 participants