[PR #20528] [MERGED] 20496 make max_page_size upper bound #15953

Closed
opened 2025-12-30 00:24:59 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20528
Author: @arthanson
Created: 10/7/2025
Status: Merged
Merged: 10/7/2025
Merged by: @bctiemann

Base: mainHead: 02496-max-page


📝 Commits (3)

  • c770e6b 20496 fix max_page_size for REST API
  • 10e8e7b 20496 fix test
  • 4db3d48 Merge branch 'main' into 02496-max-page

📊 Changes

2 files changed (+15 additions, -10 deletions)

View changed files

📝 netbox/netbox/api/pagination.py (+13 -7)
📝 netbox/utilities/tests/test_api.py (+2 -3)

📄 Description

Fixes: #20496

Refactors and fixes REST paginator checking for MAX_PAGE_SIZE, making it the upper bound.

if MAX_PAGE_SIZE is set:

  • if no limit is set return min(MAX_PAGE_SIZE, PAGINATE_COUNT)
  • if limit set return min(limit, MAX_PAGE_SIZE)
  • if limit = 0 or None return MAX_PAGE_SIZE

if MAX_PAGE_SIZE is not set:

  • if no limit is set return PAGINATE_COUNT
  • if limit is set return limit
  • if limit = 0 return all data

Note: The UI view overrides this if you set the pagination limit dropdown - i.e. if you select in the UI 1000 items and MAX_PAGE_SIZE=100, then 1000 items will still be returned in the view, which I think is correct.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20528 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 10/7/2025 **Status:** ✅ Merged **Merged:** 10/7/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `02496-max-page` --- ### 📝 Commits (3) - [`c770e6b`](https://github.com/netbox-community/netbox/commit/c770e6b45dba82302ebe9831302bb57082d34509) 20496 fix max_page_size for REST API - [`10e8e7b`](https://github.com/netbox-community/netbox/commit/10e8e7b0719d3106a64d26c448cc78b88064598f) 20496 fix test - [`4db3d48`](https://github.com/netbox-community/netbox/commit/4db3d488ad9b78d2bbbb910ed3dc325103b7ad77) Merge branch 'main' into 02496-max-page ### 📊 Changes **2 files changed** (+15 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/api/pagination.py` (+13 -7) 📝 `netbox/utilities/tests/test_api.py` (+2 -3) </details> ### 📄 Description ### Fixes: #20496 Refactors and fixes REST paginator checking for MAX_PAGE_SIZE, making it the upper bound. if MAX_PAGE_SIZE is set: * if no limit is set return min(MAX_PAGE_SIZE, PAGINATE_COUNT) * if limit set return min(limit, MAX_PAGE_SIZE) * if limit = 0 or None return MAX_PAGE_SIZE if MAX_PAGE_SIZE is not set: * if no limit is set return PAGINATE_COUNT * if limit is set return limit * if limit = 0 return all data Note: The UI view overrides this if you set the pagination limit dropdown - i.e. if you select in the UI 1000 items and MAX_PAGE_SIZE=100, then 1000 items will still be returned in the view, which I think is correct. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:24:59 +01:00
adam closed this issue 2025-12-30 00:24:59 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15953