Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6ef7db566
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # warnings are not supported in Pydantic v1 | ||
| warnings=True if PYDANTIC_V1 else warnings, | ||
| by_alias=by_alias, | ||
| by_alias=bool(by_alias), |
There was a problem hiding this comment.
Preserve
None semantics for by_alias
In Pydantic v2, passing by_alias=None to model_dump() means “use the model config default” (e.g., serialize_by_alias=True), but coercing with bool(by_alias) turns None into False and unconditionally disables alias serialization. This changes output keys for models that rely on config-driven alias behavior whenever callers omit by_alias (or pass None), so the compatibility helper no longer matches native v2 behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
So should I add a condition that sets it to True if by_alias is None?
Fixes #2921
Added coercing by_alias to bool in openai/_compat.py so it's compatible with Pydantic v2.