refactor: Use Pydantic models instead of custom dict representations#650
Draft
refactor: Use Pydantic models instead of custom dict representations#650
Conversation
- Replace inline dicts in resource clients with Pydantic request models for type-safe request construction - Move payload cleanup (None filtering) into base class as _clean_json_payload, replacing filter_none_values utility - Simplify _create/_update signatures to accept **kwargs - Add proper type conversions for list[dict] → list[Model], str → AnyUrl, dict → TaskInput - Remove _representations.py (orphaned after Pydantic model migration) - Remove enum_to_value utility (redundant with StrEnum) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #650 +/- ##
===========================================
- Coverage 96.62% 76.87% -19.76%
===========================================
Files 45 45
Lines 4271 4320 +49
===========================================
- Hits 4127 3321 -806
- Misses 144 999 +855
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
_representations.pyhelper functions with Pydantic request models (CreateActorRequest,UpdateActorRequest,ScheduleCreate,WebhookCreate, etc.) for constructing API payloads_update()/_create()inResourceClientto accept**kwargsand use a new_clean_json_payload()method instead of the removedfilter_none_values()utilityenum_to_value()from_utils.py— Pydantic serialization handles enum conversionTest plan
🤖 Generated with Claude Code