strawberry-django
strawberry-django copied to clipboard
Default pagination default max
We should a default to the standard pagination 😊
The current implementation, when passing pagination=True to the field or to the type (which means including it on all fields) is to add this input in the arguments and apply it to the queryset when passed to the query.
Maybe we should have a default "max results" on django settings, defaulting to 100 maybe, and type limit: Optional[int] = None.
Some things to consider:
-
limitis currently defaulting to-1. I'm not sure why as, considering the implementation, is basically means that not passing alimitwould make the code either break (qs[0:-1] raises an error) or not work (qs[10:-9] returns no results) -
But because of that, that also means that when someone uses the pagination, they are probably passing a limit together, meaning the change in typing should not break anything.
-
In the current implementation, when no pagination is passed the queryset will not be limited. Should we enforce the limit to that "max results", as long as the field has
pagination=True?
In my use case, it would be ideal to also set an absolute max on the what the limit value can be.
In my use case, it would be ideal to also set an absolute max on the what the
limitvalue can be.
yes, definitely, we shouldn't allow to fetch too many things