Send filter array operators as a single form field in URLFormEncoder (v4.25.1) - #139
Conversation
in/not_in/between carry the whole array in one field (updated_at[between]=[a,b]). Only ListParamEncoder did this, and it keys off nesting level, so filters on export operations were index-encoded as [between][0]/[between][1] and silently dropped by the API. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough
ChangesFilter array encoding
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ValueObjects/Encoders/URLFormEncoder.php`:
- Around line 42-45: Restrict the special JSON encoding in URLFormEncoder’s
array-handling branch to explicit filter context or an opt-in, rather than any
array key named in, not_in, or between. Preserve recursive indexed encoding for
nested non-filter arrays such as metadata[in], while keeping the existing
compact filter representation when the caller explicitly marks the value as a
filter.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 21711957-2331-49e0-9223-829d90253624
📒 Files selected for processing (5)
CHANGELOG.mdVERSIONsrc/ValueObjects/Encoders/URLFormEncoder.phpsrc/Version.phptests/ValueObjects/Encoder/URLFormEncoderTest.php
An empty in/not_in/between array is now omitted instead of being sent as an empty JSON array. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Filter operators
in,not_inandbetweencarry the whole array in one form field, e.g.updated_at[between]=[1704067200,1717199999]. OnlyListParamEncoderdid this, and it keys off nesting level, so filters on export operations were index-encoded as[between][0]/[between][1]and ignored by the API — an export silently returned unfiltered data.URLFormEncodernow handles these operators at any nesting depth. Ordinary arrays such ascoupon_idskeep their index encoding.Found while validating published code samples:
$chargebee->export()->ramps(["ramp" => ["effective_from" => ["between" => [a, b]]]])sentand now sends
Released as v4.25.1.
Test plan
vendor/bin/phpunit— 62 passingramp[effective_from][between]) and top-level (updated_at[between]) operatorsphpstanclean onsrc/ValueObjects/EncodersMade with Cursor
Updated
URLFormEncoderto JSON-encode non-emptyin,not_in, andbetweenfilter arrays as single fields at any nesting depth. Empty filter arrays are omitted. Added nested and top-level tests. Preserved ordinary array encoding and released version4.25.1.