Skip to content

Conversation

@nesitor
Copy link
Member

@nesitor nesitor commented Apr 7, 2025

Upgrade pydantic v1 to v2

Self proofreading checklist

  • Is my code clear enough and well documented
  • Are my files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • Database migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Changes

  • Upgraded the codebase from Pydantic v1 to Pydantic v2
  • Updated schema validation to use the new Pydantic v2 API
  • Removed dependency on dataclasses-json in favor of Pydantic models
  • Updated JSON serialization to work with Pydantic v2

How to test

Test it on staging CCN to check if everything is working well, like the whole process and all message types.

Notes

🤖 Generated with Claude Code

@nesitor nesitor requested review from 1yam and amalcaraz April 7, 2025 17:25
@nesitor nesitor self-assigned this Apr 7, 2025
@nesitor nesitor force-pushed the andres-feature-upgrade_pydantic_v1_to_v2 branch from 252de0c to c559b16 Compare April 7, 2025 17:31
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@nesitor nesitor force-pushed the andres-feature-upgrade_pydantic_v1_to_v2 branch from c559b16 to 06ae425 Compare April 7, 2025 18:09
@nesitor nesitor force-pushed the andres-feature-upgrade_pydantic_v1_to_v2 branch 3 times, most recently from d63b987 to 0051895 Compare April 7, 2025 19:09
@nesitor nesitor force-pushed the andres-feature-upgrade_pydantic_v1_to_v2 branch from 0051895 to acf0fa4 Compare April 7, 2025 19:15
nesitor and others added 10 commits April 8, 2025 16:48
Change from using __annotations__.keys() to model_fields.keys() to properly
extract field names from Pydantic v2 models when generating GraphQL queries.
This fixes the ValidationError with missing required fields in IndexerEventResponse.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Change from using __annotations__.keys() to model_fields.keys() to properly
extract field names from Pydantic v2 models when generating GraphQL queries.
This fixes the ValidationError with missing required fields in IndexerEventResponse.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Member

@1yam 1yam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nesitor nesitor merged commit 9466fee into main Apr 9, 2025
5 checks passed
@nesitor nesitor mentioned this pull request Apr 16, 2025
6 tasks
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.

4 participants