Skip to content

debt: use alias_generator=to_camel on Pydantic models - #2121

Open
RohithPariki wants to merge 1 commit into
apify:masterfrom
RohithPariki:issue-1954
Open

debt: use alias_generator=to_camel on Pydantic models#2121
RohithPariki wants to merge 1 commit into
apify:masterfrom
RohithPariki:issue-1954

Conversation

@RohithPariki

Copy link
Copy Markdown

Description

This PR cleans up the manual camelCase aliasing across our Pydantic models.

Instead of adding Field(alias="camelCaseName") everywhere, I've updated the ConfigDict on our models to use alias_generator=to_camel and populate_by_name=True. I then stripped out all the redundant alias= strings from the individual fields.

A few notes:

  • I left specific internal overrides (like alias='__crawlee') untouched so we don't break any core logic.
  • Ran ruff to clean up the formatting after removing the fields.

Issues

Testing

  • Verified locally that Pydantic models with alias_generator=to_camel and populate_by_name=True correctly map incoming camelCase JSON keys into snake_case Python attributes, perfectly mimicking the behavior of the removed manual aliases.

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.

Use alias_generator=to_camel on Pydantic models instead of manual per-field aliases

2 participants