The REST API paginator should raise an exception if attempting to paginate an unordered queryset
Proposed Changes
Our OptionalLimitOffsetPagination pagination class should raise an exception whenever pagination is attempted on a queryset with no ordering applied.
Justification
This change was prompted by bug #18729. A queryset with no ordering applied (e.g. because of an applied annotation) is nondeterministic. Paginating through such a queryset is unreliable; an object can appear on multiple pages. Raising an exception exposes this dangerous condition.
Would it be possible to get a comprehensive list of endpoints that would be affected? Based on the other issue, it looks like querysets within views that use the annotate aggregation. But is this the only method that would affect the ordering?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
Would it be possible to get a comprehensive list of endpoints that would be affected? Based on the other issue, it looks like querysets within views that use the annotate aggregation. But is this the only method that would affect the ordering?
The following API endpoints appear to be affected:
- /api/extras/tagged-objects/
- /api/users/tokens/