-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Fix usage with default and default_factory arguments #3333
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3333 +/- ##
==========================================
- Coverage 96.62% 96.61% -0.02%
==========================================
Files 485 485
Lines 30292 30316 +24
Branches 3746 3751 +5
==========================================
+ Hits 29271 29291 +20
- Misses 832 835 +3
- Partials 189 190 +1 |
CodSpeed Performance ReportMerging #3333 will not alter performanceComparing Summary
|
result = schema.execute_sync( | ||
""" | ||
query TestQuery{ | ||
sub { | ||
foo | ||
} | ||
} | ||
""" | ||
) |
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.
isn't this fixed by passing a root value to schema.execute? 😊
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.
sounds good. There should be a default root value in execute instead of None.
But this also happens on sub types. There should be an automatic initialization of root queries and co
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.
I get you, but I think that would make us quite opinionated, and also we can't guess how all types will be instantiated, this would only work if types don't require any argument 😊
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.
This task isn't easy as you have to provide a mutation or query instance depending on the query to execute.
this is a big task, instead of the small quick and dirty fix
Description
Currently it is not always possible to use the default and default_factory argument on strawberry.field.
It fails randomly and especially on root Query
This PR fixes the issue.
Types of Changes
Issues Fixed or Closed by This PR
Checklist