Skip to content

fix: serialize query params with the documented encoding - #57

Merged
javorosas merged 2 commits into
mainfrom
fix/nested-query-params
Sep 10, 2026
Merged

javorosas merged 2 commits into
mainfrom
fix/nested-query-params

Conversation

@javorosas

Copy link
Copy Markdown
Member

What

BaseClient::arrayToParams() now emits the query encoding the API documents and the other official SDKs send:

  • Lists repeat the key: status=valid&status=canceled (was status[0]=valid&status[1]=canceled).
  • null values are omitted instead of being sent empty (q=). Passing an empty string still sends an explicit empty value (q=).
  • Associative arrays keep bracket notation (date[gte]=...&date[lte]=...) and booleans keep true/false.

This aligns the encoding with the deepObject style documented for nested filters and the default form + explode style for arrays, and with the other SDKs, so the same search sends the same URL everywhere.

Tests

vendor/bin/phpunit
OK (55 tests, 201 assertions)

New cases cover a list value, a null value, and an explicit empty string.

Release note

VERSION.md records the fix under the pending 4.8.0 entry.

@javorosas
javorosas requested review from raul-facturapi and a lite review from Copilot September 10, 2026 16:28
@javorosas javorosas self-assigned this Sep 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The functional changes are well-covered by tests and align with the stated API encoding, with only a minor release-note spelling nit identified.

Pull request overview

Updates BaseClient::arrayToParams() to serialize query parameters using the encoding documented by the API (and used by other official SDKs), ensuring consistent URLs for equivalent searches across SDKs.

Changes:

  • Refactors query parameter serialization to repeat keys for list values, keep bracket notation for associative arrays, and omit null values.
  • Adds PHPUnit coverage for list repetition, null omission, and explicit empty-string handling.
  • Records the fix under the pending 4.8.0 entry in VERSION.md.
File summaries
File Description
src/Http/BaseClient.php Implements the updated query parameter encoding via a dedicated helper.
tests/Resources/InvoicesTest.php Adds regression tests for list, null, and empty-string query parameter behavior.
VERSION.md Documents the serialization change in the pending release notes.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread VERSION.md Outdated
@javorosas
javorosas merged commit 5e28b8a into main Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants