Skip to content

Add --use-serialization-alias option for Pydantic v2#2905

Merged
koxudaxi merged 2 commits intomainfrom
feature/use-serialization-alias
Jan 2, 2026
Merged

Add --use-serialization-alias option for Pydantic v2#2905
koxudaxi merged 2 commits intomainfrom
feature/use-serialization-alias

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Jan 2, 2026

Fixes: #2030

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 2, 2026

Warning

Rate limit exceeded

@koxudaxi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8b7c441 and 7fbf864.

📒 Files selected for processing (20)
  • docs/cli-reference/field-customization.md
  • docs/cli-reference/index.md
  • docs/cli-reference/quick-reference.md
  • src/datamodel_code_generator/__main__.py
  • src/datamodel_code_generator/_types/generate_config_dict.py
  • src/datamodel_code_generator/_types/parser_config_dicts.py
  • src/datamodel_code_generator/arguments.py
  • src/datamodel_code_generator/cli_options.py
  • src/datamodel_code_generator/config.py
  • src/datamodel_code_generator/model/base.py
  • src/datamodel_code_generator/model/pydantic_v2/base_model.py
  • src/datamodel_code_generator/parser/base.py
  • src/datamodel_code_generator/parser/graphql.py
  • src/datamodel_code_generator/parser/jsonschema.py
  • src/datamodel_code_generator/parser/openapi.py
  • src/datamodel_code_generator/prompt_data.py
  • tests/data/expected/main/input_model/config_class.py
  • tests/data/expected/main_kr/use_serialization_alias/output.py
  • tests/main/test_public_api_signature_baseline.py
  • tests/test_main_kr.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 2, 2026

📚 Docs Preview: https://pr-2905.datamodel-code-generator.pages.dev

@koxudaxi koxudaxi force-pushed the feature/use-serialization-alias branch from 6906ccb to 6fb16b6 Compare January 2, 2026 18:02
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 2, 2026

CodSpeed Performance Report

Merging #2905 will not alter performance

Comparing feature/use-serialization-alias (7fbf864) with main (8b7c441)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 11 untouched
⏩ 98 skipped1

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@koxudaxi koxudaxi enabled auto-merge (squash) January 2, 2026 18:08
@koxudaxi koxudaxi merged commit 3db6667 into main Jan 2, 2026
37 checks passed
@koxudaxi koxudaxi deleted the feature/use-serialization-alias branch January 2, 2026 18:10
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 2, 2026

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: This PR adds a new optional CLI flag --use-serialization-alias and corresponding Python API parameter use_serialization_alias with a default value of False. Since this is purely additive and the default preserves existing behavior (using alias instead of serialization_alias), there are no breaking changes. Users must explicitly opt-in to use the new feature. All existing CLI commands and API calls continue to work unchanged.


This analysis was performed by Claude Code Action

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.38%. Comparing base (a310b6f) to head (7fbf864).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2905   +/-   ##
=======================================
  Coverage   99.38%   99.38%           
=======================================
  Files          92       92           
  Lines       16342    16374   +32     
  Branches     1934     1940    +6     
=======================================
+ Hits        16241    16273   +32     
  Misses         52       52           
  Partials       49       49           
Flag Coverage Δ
unittests 99.38% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 2, 2026

🎉 Released in 0.52.0

This PR is now available in the latest release. See the release notes for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sometimes using serialization_alias would be better than using alias; this should be switchable

1 participant