Boolean list elements are encoded as True/False instead of true/false
メンテナーはふだん 1 日以内に返信
@inchang-ing がすでに取り組んでいます。
2026年10月20日 から。
評価
調査の方向性
stripe/_encode.py の _api_encode() から始め、リスト/タプルの分岐と、単独の値およびネストされた辞書の値に対する Boolean の処理を比較してください。次に、_api_encode() を対象とするエンコードテストを実行し、リスト内の Boolean 要素のケースを追加してください。エンコードされた配列の値が小文字の true と false になり、他の位置の値と一貫していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Description
stripe._encode._api_encode() serializes Boolean values inconsistently depending on their position in the request parameters.
Top-level and nested-dictionary Booleans become lowercase true / false, but Booleans directly inside lists remain Python True / False when URL-encoded.
Minimal reproduction
from urllib.parse import urlencode
from stripe._encode import _api_encode
cases = {
"standalone": {"enabled": True},
"array": {"enabled": [True, False]},
"nested": {"enabled": {"flag": True}},
}
for name, params in cases.items():
print(name, urlencode(list(_api_encode(params))))
Actual behavior
standalone enabled=true
array enabled%5B0%5D=True&enabled%5B1%5D=False
nested enabled%5Bflag%5D=true
Expected behavior
Boolean array elements should be serialized consistently as lowercase true and false.
Root cause
The list/tuple branch of _api_encode() yields scalar array elements directly without applying the Boolean conversion used elsewhere.
Source:
https://github.com/stripe/stripe-python/blob/master/stripe/_encode.py
Existing tests cover top-level Boolean values and lists separately, but not Booleans directly inside lists.
Verification
Reproduced locally using the current upstream _api_encode() implementation in an isolated Python harness.
No live Stripe API request was made, and the full installed SDK test suite was not executed. The potential impact on specific API endpoints has not yet been established.
To Reproduce
- Use the current "stripe-python" "_api_encode()" implementation.
- Run the Python example provided in the Minimal reproduction section above. No Stripe API key or network access is required.
- Compare the URL-encoded output for standalone, nested, and array Boolean values.
- Observe that standalone and nested Booleans become lowercase "true" / "false", while array elements become uppercase "True" / "False".
- Expected: All Boolean values should use consistent lowercase encoding regardless of nesting.
Expected behavior
Boolean values should be consistently serialized as lowercase "true" and "false", regardless of whether they appear as standalone values, nested dictionary fields, or array elements.
For example:
enabled%5B0%5D=true&enabled%5B1%5D=false
Instead of:
enabled%5B0%5D=True&enabled%5B1%5D=False
The encoded representation should not depend on the nesting structure.
Code snippets
OS
ubuntu
Language version
Python 3.13
Library version
Development branch (master); isolated source reproduction, no installed SDK
API version
N/A — no Stripe API request performed
Additional context
No response
- 主要言語
- Python
- スター
- 2.1k
- フォーク
- 539
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stripe/stripe-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
stripe/stripe-python#1948 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stripe/stripe-python#1936 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
stripe/stripe-python#1941 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
stripe/stripe-python#1886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 54/100
stripe/stripe-python#1841 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
stripe/stripe-python の issue をすべて見る
似ている issue
-
resource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
hesreallyhim/awesome-claude-code#3214 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
doobidoo/mcp-memory-service#1650 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ml-explore/mlx-lm#2002 ·
メンテナーはふだん 2 日以内に返信