-
Notifications
You must be signed in to change notification settings - Fork 464
Update v2 array parameter serialization to use indexed format #1669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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]: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
jar-stripe
left a comment
There was a problem hiding this 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]: |
There was a problem hiding this comment.
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.
Why?
Stripe has updated how array parameters are handled in
GETandDELETEmethods to/v2endpoints. 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?
stripe/_encode.pyto always use indexed array format for all API modesapi_modeargument to_api_encodefunction and all references to ittests/test_http_client.pyto reflect new behavior