debt: use alias_generator=to_camel on Pydantic models - #2121
Open
RohithPariki wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR cleans up the manual camelCase aliasing across our Pydantic models.
Instead of adding
Field(alias="camelCaseName")everywhere, I've updated theConfigDicton our models to usealias_generator=to_camelandpopulate_by_name=True. I then stripped out all the redundantalias=strings from the individual fields.A few notes:
alias='__crawlee') untouched so we don't break any core logic.ruffto clean up the formatting after removing the fields.Issues
alias_generator=to_camelon Pydantic models instead of manual per-field aliases #1954Testing
alias_generator=to_camelandpopulate_by_name=Truecorrectly map incoming camelCase JSON keys into snake_case Python attributes, perfectly mimicking the behavior of the removed manual aliases.