Skip to content

Conversation

@mbroshi-stripe
Copy link
Contributor

@mbroshi-stripe mbroshi-stripe commented Nov 11, 2025

Why?

Stripe has updated how array parameters are handled in GET and DELETE methods to /v2 endpoints. Previously, the SDKs were serializing them with repeated parameter format (e.g., ?include=foo&include=bar) since that is was the API expected. While that format is still accepted, it is deprecated. Instead, we will serialize array parameters to use indexed format (e.g., ?include[0]=foo&include[1]=bar), which is the preferred method going forward. This aligns v2 behavior with v1 for consistency.

What?

  • Modified stripe/_encode.py to always use indexed array format for all API modes
  • Removed api_mode argument to _api_encode function and all references to it
  • Updated test expectations in tests/test_http_client.py to reflect new behavior

mbroshi-stripe and others added 3 commits November 10, 2025 20:32
Change array parameter serialization for v2 endpoints to use indexed
format (e.g., ?include[0]=foo&include[1]=bar) instead of the repeated
parameter format (e.g., ?include=foo&include=bar). This aligns v2
behavior with v1 for consistency.

Changes:
- Modified _encode.py _api_encode to always use indexed format
- Updated tests to expect indexed format for v2 arrays

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Committed-By-Agent: claude
def _api_encode(
data, api_mode: Optional[str]
) -> Generator[Tuple[str, Any], None, None]:
def _api_encode(data) -> Generator[Tuple[str, Any], None, None]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a breaking change? I'm assuming because it starts with a _ we're OK, but I'm not too sure how we treat that from a semver point of view

Copy link
Contributor

Choose a reason for hiding this comment

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

in python, an _ prefix conventionally means "private" and most linters will at least complain if someone is trying to access a method prefixed with an _. I think this is not a breaking change here.

@mbroshi-stripe mbroshi-stripe marked this pull request as ready for review November 11, 2025 17:01
@mbroshi-stripe mbroshi-stripe requested a review from a team as a code owner November 11, 2025 17:01
@mbroshi-stripe mbroshi-stripe requested review from jar-stripe and removed request for a team November 11, 2025 17:01
Copy link
Contributor

@jar-stripe jar-stripe left a comment

Choose a reason for hiding this comment

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

LG!

def _api_encode(
data, api_mode: Optional[str]
) -> Generator[Tuple[str, Any], None, None]:
def _api_encode(data) -> Generator[Tuple[str, Any], None, None]:
Copy link
Contributor

Choose a reason for hiding this comment

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

in python, an _ prefix conventionally means "private" and most linters will at least complain if someone is trying to access a method prefixed with an _. I think this is not a breaking change here.

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