fix(rest-catalog): serialize purgeRequested as lowercase boolean string - #3837
fix(rest-catalog): serialize purgeRequested as lowercase boolean string#3837swjtu-zhanglei wants to merge 1 commit into
Conversation
* Python's requests library serializes bool True as "True" (capitalized) in query parameters. Per OpenAPI 3.0 spec (JSON Schema Wright Draft 00, RFC 7159 Section 3), boolean query parameters must be serialized as lowercase "true"/"false". Servers that strictly validate boolean values (e.g., Aliyun OSS Tables) reject "True" with 400 Bad Request. * Use explicit "true"/"false" string literals for spec-compliant wire format.
rambleraptor
left a comment
There was a problem hiding this comment.
I'm a little confused by this. Doesn't requests do this for us? We aren't doing this anywhere else. Why is this the only place we're seeing this issue?
Thanks for the question. I traced through the full code path — requests does not handle boolean serialization for us. Here's the detailed The full call chain with source references Step 1: requests/models.py:473 — entry point Step 3: urllib/parse.py:980 — stdlib urlencode(query, doseq=True) With doseq=True, the code enters the branch at line 1029. For each (k, v) pair: Why this is the only place we see the issue A grep for params={ in pyiceberg/catalog/rest/init.py shows drop_table is the only call site that passes a Python bool as a query param Other Iceberg implementations get this right iceberg-go (catalog/rest/rest.go:1838,1864): |
Python's requests library serializes bool True as "True" (capitalized) in query parameters. Per OpenAPI 3.0 spec (JSON Schema Wright Draft 00, RFC 7159 Section 3), boolean query parameters must be serialized as lowercase "true"/"false". Servers that strictly validate boolean values (e.g., Aliyun OSS Tables) reject "True" with 400 Bad Request.
Use explicit "true"/"false" string literals for spec-compliant wire format.
Rationale for this change
Are these changes tested?
Are there any user-facing changes?