-
-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using a static method as a resolver (#1430)
Co-authored-by: Patrick Arminio <[email protected]> Co-authored-by: ignormies <[email protected]>
- Loading branch information
1 parent
c5a1b61
commit 2139e63
Showing
6 changed files
with
184 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Release type: patch | ||
|
||
This release fixes an issue that prevented using `classmethod`s and `staticmethod`s as resolvers | ||
|
||
```python | ||
import strawberry | ||
|
||
@strawberry.type | ||
class Query: | ||
@strawberry.field | ||
@staticmethod | ||
def static_text() -> str: | ||
return "Strawberry" | ||
|
||
@strawberry.field | ||
@classmethod | ||
def class_name(cls) -> str: | ||
return cls.__name__ | ||
``` |
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
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