Repository navigation
fix(python): serialize JSON header parameter content - #25068
Merged
wing328 merged 2 commits intoOct 4, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
Author
|
@fa0311 @krjakbrjak would you mind taking a look when you have a chance? This is a small Python client bug fix with regression coverage and green CI. This issue currently blocks our work on a new Dropbox SDK generated with OpenAPI Generator, so getting it into the next release would be very helpful. Thanks! |
This was referenced Oct 1, 2026
Closed
Member
|
lgtm. let's give it a try. thanks for the contribution. |
3 tasks
Member
|
FYI. Merged #25112 to add tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix Python client serialization of header parameters defined with
content: application/json.Previously, the generated client assigned the parameter directly to the
header:
ApiClient.sanitize_for_serialization()converts model instances todictionaries, but those values were not JSON-encoded before being used
as HTTP header values.
This change:
json.dumps()aftersanitize_for_serialization();headers.
Generated code for a JSON-content header now uses:
while a regular header remains:
Tests
Added
testJsonContentHeaderUsesJsonSerializationtoPythonClientCodegenTest.The regression test verifies that:
content: application/jsonheader parameters are JSON serialized;Fixes #25067
Summary by cubic
Fixes a bug in the generated Python client where header parameters defined with
content: application/jsonwere sent without JSON serialization. These headers are now encoded withjson.dumps()aftersanitize_for_serialization(), while regular header parameters keep their previous behavior. Thejsonimport is generated only when an API uses a JSON-content header, and regression tests cover both cases.Written for commit 2d53ce8. Summary will update on new commits.