-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with unnamed unions and generics (#3099)
* Fix issue with unnamed unions and generics * Remove unused resolvers * Ignore 3.12 in black for now
- Loading branch information
Showing
5 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Release type: patch | ||
|
||
This release fixes an issue that would prevent using generics with unnamed | ||
unions, like in this example: | ||
|
||
```python | ||
from typing import Generic, TypeVar, Union | ||
import strawberry | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
@strawberry.type | ||
class Connection(Generic[T]): | ||
nodes: list[T] | ||
|
||
|
||
@strawberry.type | ||
class Entity1: | ||
id: int | ||
|
||
|
||
@strawberry.type | ||
class Entity2: | ||
id: int | ||
|
||
|
||
@strawberry.type | ||
class Query: | ||
entities: Connection[Union[Entity1, Entity2]] | ||
``` |
This file contains 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
This file contains 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
This file contains 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