feat: server-side search, declarative ordering and advanced filters - #11
Merged
Conversation
added 2 commits
September 7, 2026 04:43
- New ListConfig inner class on Pydantic schemas: search_fields, ordering_fields, ordering (default), filters (whitelist) - ?search= does case-insensitive substring matching across search_fields - ?ordering= validated against ordering_fields (- prefix for desc, 400 on unknown fields, declarative default when omitted) - Filter query params with eq/ne/gt/gte/lt/lte/contains/in operators, values coerced to int/float/bool, whitelist enforced - Implemented in SQLAlchemy (sync+async), Tortoise and Peewee adapters - utils/async_utils get_list_queryset accept the new arguments; new kwargs are only forwarded when used (custom adapters keep working) - Fully backward compatible: no ListConfig -> unchanged behaviour - 31 new tests (294 total, 88.5% coverage) - Docs: pagination-filtering.md rewritten, feature matrix and roadmap updated (last two Roadmap rows are now Supported) - Version bump to 1.5.0, release notes added
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the last two Roadmap rows of the feature matrix (v1.5.0):
?search=on LIST — server-side case-insensitive substring search acrossListConfig.search_fields?ordering=validated againstListConfig.ordering_fields,-prefix for descending, declarative defaultorderingwhen omitted,400on unknown fields?<field>=exact match plusne/gt/gte/lt/lte/contains/inoperators, restricted to theListConfig.filterswhitelist, values auto-coerced to int/float/boolAll built-in adapters supported: SQLAlchemy (sync & async), Tortoise ORM, Peewee — on both
BaseViewsetandAsyncBaseViewset.Design: fully declarative via an inner
ListConfigclass on the Pydantic response schema (same pattern asRelatedConfigfor eager loading). Without it, LIST behaves exactly as before — backward compatible, and custom adapters keep working because new kwargs are only forwarded when used.Testing
tests/test_search_ordering.py: config parsing helpers, sync/async viewsets end-to-end via TestClient, Tortoise/Peewee adapter behaviourmkdocs build --strictpassesDocs
docs/pagination-filtering.mdrewritten aroundListConfig