Fix size=0 query parameter to return all floors instead of default 30#201
Closed
Fix size=0 query parameter to return all floors instead of default 30#201
Conversation
Co-authored-by: KYLN24 <54014142+KYLN24@users.noreply.github.com>
- Added check for raw query parameters before validation applies defaults - When both size=0 and offset=0, return all floors instead of limiting to 30 - Added test case to verify the fix - Added treehole_next binary to .gitignore Co-authored-by: KYLN24 <54014142+KYLN24@users.noreply.github.com>
Co-authored-by: KYLN24 <54014142+KYLN24@users.noreply.github.com>
Co-authored-by: KYLN24 <54014142+KYLN24@users.noreply.github.com>
Co-authored-by: KYLN24 <54014142+KYLN24@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with floor request limiting response to 30 items
Fix size=0 query parameter to return all floors instead of default 30
Nov 24, 2025
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the API endpoint /api/holes/{hole_id}/floors?size=0&offset=0 was incorrectly returning only 30 floors instead of all floors. The issue occurs because the ListModel schema has a default:"30" tag that causes the validation framework to replace size=0 with the default value of 30, preventing the special case logic from detecting the request for all floors.
Key Changes:
- Added raw query parameter checking before validation to detect explicit
size=0&offset=0requests - Updated
ListFloorsInAHoleto passnilfor both offset and size toMakeQuerySetwhen the special case is detected, returning all floors without limit - Added test case to verify all 50 test floors are returned with
size=0&offset=0parameters
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.gitignore |
Adds treehole_next binary to gitignore |
tests/floor_test.go |
Adds test case verifying size=0&offset=0 returns all 50 floors in the test hole |
apis/floor/apis.go |
Implements raw query parameter check before validation to detect size=0&offset=0 and bypass pagination, matching ListFloorsOld behavior for backward compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The API endpoint
/api/holes/{hole_id}/floors?size=0&offset=0was returning only 30 floors instead of all floors. The validation framework applies a default value of 30 whensize=0is passed, preventing the special case from being detected.Changes
apis/floor/apis.go: Check raw query parameters before validation to detect explicitsize=0&offset=0and passniltoMakeQuerySetfor unlimited resultstests/floor_test.go: Add test case verifying all 50 test floors are returned.gitignore: Addtreehole_nextbinaryExample
This matches the existing behavior in
ListFloorsOldfor backward compatibility.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.