-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Strawberry config to a typed dict #3365
base: main
Are you sure you want to change the base?
Move Strawberry config to a typed dict #3365
Conversation
…nfig_to_a_typed_dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! I'll take a proper look soon, but I was wonder if you're interested in writing a codemod for this too? 😊
We have one here: https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/codemods/annotated_unions.py
Also I think we could keep the name of the dict the same, since it is mostly backwards compatible (dict(a=1)
is almost the same as {"a": 1}
)
…_a_typed_dict' into feature/move_strawberryconfig_to_a_typed_dict
Hi @patrick91 , |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3365 +/- ##
==========================================
- Coverage 96.40% 95.31% -1.09%
==========================================
Files 498 500 +2
Lines 31120 31160 +40
Branches 3813 3809 -4
==========================================
- Hits 30000 29701 -299
- Misses 914 1250 +336
- Partials 206 209 +3 |
CodSpeed Performance ReportMerging #3365 will not alter performanceComparing Summary
|
Description
This MR aims to change Strawberry's schema config to be a typed dictionary. Then only one import would be required to instantiate the schema.
In the
Schema
class initialization the formerdataclass
is used to handle default values and validations. Then, my approach for this fix was not to remove the old dataclass.UTs were updated accordingly.
Types of Changes
Issues Fixed or Closed by This PR
Checklist