fix: apply default query params when a paginated List receives a nil request - #843
Merged
Merged
Conversation
6 tasks
duedares-rvj
approved these changes
Aug 5, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #843 +/- ##
=======================================
Coverage 87.05% 87.05%
=======================================
Files 398 399 +1
Lines 184157 184162 +5
=======================================
+ Hits 160310 160315 +5
Misses 17863 17863
Partials 5984 5984 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
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.
🔧 Changes
Addresses #826, where calling a paginated
Listmethod with anilrequest pointer failed to decode with:When the request is
nil,internal.QueryValuesWithDefaultsreturned early before applying its defaults, soinclude_totalswas never sent. The Auth0 API defaultsinclude_totalstofalseand returns a bare JSON array instead of the totals-wrapped object, and the generated paginated response type can only decode the object shape, so unmarshaling failed. This affected every paginatedListthat relies on default query parameters (the 27 endpoints that defaultinclude_totals: true, pluspage/per_pagedefaults on the others).Now a
nilrequest applies the client's default query parameters (notablyinclude_totals=true), so the object-shaped response is returned and decodes successfully, matching the behavior of passing an empty request struct.This mirrors the upstream Fern
applyQueryDefaultsOnNilRequestgenerator option (fern-api/fern#17256):management/internal/query.go: adds theapplyQueryDefaultsOnNilRequestflag and applies defaults on a nil request when it is enabled.management/internal/query_defaults_on_nil.go: enables the flag via aninitfunction. Newer generator versions emit this file automatically; it is added manually here because this SDK is built with an older generator.management/internal/query_test.go: adds coverage for the nil-request behavior with the flag enabled and disabled..fernignore: preserves the above files across regeneration.📚 References
🔬 Testing
Covered by the added cases in
management/internal/query_test.go.go build ./...,go vet ./management/..., andgo test ./management/internal/...all pass.📝 Checklist