-
-
Notifications
You must be signed in to change notification settings - Fork 536
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 issue with LazyType
/Enum
s and generics
#1235
Conversation
Thanks for adding the Here's a preview of the changelog: Fix issues (#1158 and #1104) where Generics using LazyTypes These now function as expected: EnumT = TypeVar("T")
@strawberry.enum
class VehicleMake(Enum):
FORD = 'ford'
TOYOTA = 'toyota'
HONDA = 'honda'
@strawberry.type
class GenericForEnum(Generic[T]):
generic_slot: T
@strawberry.type
class SomeType:
field: GenericForEnum[VehicleMake] LazyType
@strawberry.type
class TypeFromAnotherFile:
something: bool
T = TypeVar("T")
@strawberry.type
class GenericType(Generic[T]):
item: T
@strawberry.type
class RealType:
lazy: GenericType[LazyType["TypeFromAnotherFile", "another_file.py"]] Here's the preview release card for twitter: Here's the tweet text:
|
Codecov Report
@@ Coverage Diff @@
## main #1235 +/- ##
==========================================
+ Coverage 97.63% 97.69% +0.06%
==========================================
Files 88 88
Lines 3382 3388 +6
Branches 496 498 +2
==========================================
+ Hits 3302 3310 +8
+ Misses 44 43 -1
+ Partials 36 35 -1 |
@patrick91, looks like the mypy plugin isn't ready for this.
|
LazyType
and genericsLazyType
/Enum
s and generics
Description
Resolves #1104 and #1158. This was a fairly straight-forward fix. During creation of the dynamically-generated resolved generic type, we weren't getting the name from the
LazyType
/EnumDefinition
properly.Types of Changes
Issues Fixed or Closed by This PR
Checklist