Skip to content

[PYTHON][bugfix] Fix missing post-params when content type is json#23526

Open
ilayu-blip wants to merge 3 commits intoOpenAPITools:masterfrom
ilayu-blip:fix-post-params-bug
Open

[PYTHON][bugfix] Fix missing post-params when content type is json#23526
ilayu-blip wants to merge 3 commits intoOpenAPITools:masterfrom
ilayu-blip:fix-post-params-bug

Conversation

@ilayu-blip
Copy link
Copy Markdown

@ilayu-blip ilayu-blip commented Apr 13, 2026

This fixes issue #23457

I have made the fix to be non-destructive. If this issue did not happen to you then this fix will not BREAK anything.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)

@cbornet (2017/09) @tomplus (2018/10) @krjakbrjak (2023/02) @fa0311 (2023/10) @multani (2023/10)


Summary by cubic

Fixes missing post_params for JSON requests in Python clients by sending them as the JSON payload when body is empty. Also updates .gitignore to ignore artifacts from run-in-docker.sh (refs #23457).

  • Bug Fixes

    • Add JSON fallback across templates: python/asyncio, python/tornado, python/httpx, python-pydantic-v1/asyncio, python-pydantic-v1/tornado, python-pydantic-v1; regenerated Python samples to match.
    • Serialize via json.dumps(...) or args["json"], using dict(post_params) when body is None.
  • Misc

    • Update .gitignore to exclude run-in-docker.sh generated artifacts.

Written for commit 5719862. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="modules/openapi-generator/src/main/resources/python/tornado/rest.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/python/tornado/rest.mustache:125">
P2: Truthy check overrides explicit falsy JSON bodies; should only fallback when body is None.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@ilayu-blip ilayu-blip force-pushed the fix-post-params-bug branch from e43edda to fc9b7ea Compare April 13, 2026 14:36
@wing328
Copy link
Copy Markdown
Member

wing328 commented Apr 14, 2026

please follow step 3 to update the samples so as to fix https://github.com/OpenAPITools/openapi-generator/actions/runs/24349292681/job/71112564228?pr=23526

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 6 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".gitignore">

<violation number="1" location=".gitignore:314">
P2: Overbroad `.gitignore` pattern `?/` ignores any single-character directory instead of a specific generated artifact.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
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.

2 participants