Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sorting parameters #7

Open
peterhartman opened this issue Oct 26, 2023 · 1 comment
Open

Support for sorting parameters #7

peterhartman opened this issue Oct 26, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@peterhartman
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The only sorting supported by this wrapper currently is :runtime_sort? which may be inefficient if the sorting is supported by the API.

Describe the solution you'd like
The ability to define and use sort_with and order_with properties in the endpoint definition

Describe alternatives you've considered
Currently I am using :runtime_sort?

Express the feature either with a change to resource syntax, or with a change to the resource interface

endpoint :list_users do
  path("/users")
  limit_with {:param, "limit"}
  sort_with {:param, "sortBy"}
  order_with {:param, "order"}
  # runtime_sort? true
  paginator CustomPaginator
end
@peterhartman peterhartman added the enhancement New feature or request label Oct 26, 2023
@zachdaniel
Copy link
Collaborator

I think we may want to go with the same strategy we've used for paginator as it allows for more complex behaviors. We should probably do that for limit too, TBH. i.e limiter {LimitParam, "limit"}, sorter {SortParam, ...}. Because some apis support things like sort=foo,-bar,+baz and some require providing the parameter multiple times, or splitting the order and the sort params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants