Skip to content

Conversation

EspenHa
Copy link
Contributor

@EspenHa EspenHa commented Oct 12, 2025

This PR changes the to_json method of generated models to use
Pydantic v2's .model_dump_json instead of json.dumps.
This fixes #22063.

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)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@EspenHa EspenHa force-pushed the fix_python_to_json_with_uuid branch from 2f29196 to 4863b63 Compare October 12, 2025 09:49
@EspenHa EspenHa marked this pull request as draft October 12, 2025 10:26
@EspenHa
Copy link
Contributor Author

EspenHa commented Oct 12, 2025

Tests seem to be failing due to differences in how json is generated in Python's stdlib json module, and pydantic.

I might come back and fix this later if there is interest for moving this PR forward.

@wing328
Copy link
Member

wing328 commented Oct 14, 2025

@EspenHa thanks for the PR

can you please PM me via Slack to discuss this further?

@EspenHa EspenHa force-pushed the fix_python_to_json_with_uuid branch from 670e463 to fabc91f Compare October 15, 2025 10:21
@EspenHa EspenHa force-pushed the fix_python_to_json_with_uuid branch from fabc91f to 7f429d4 Compare October 15, 2025 10:31
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.

[BUG][PYTHON] JSON serialization fails for UUID fields in generated Python

2 participants