Last active
November 26, 2021 17:40
-
-
Save tudormunteanu/62bfc542b79314a8ee0d957c589b8d47 to your computer and use it in GitHub Desktop.
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
(graphene_mypy) ~/work/zego/experiments/graphene_mypy/ cat app/api/schema.py | |
from graphene import Boolean, Field, ObjectType, ResolveInfo | |
class Query(ObjectType): | |
healthy = Boolean() <--------------- this is what the Graphene docs deem as recommended | |
@staticmethod | |
def resolve_healthy(_: None, __: ResolveInfo) -> bool: | |
return True | |
(graphene_mypy) ~/work/zego/experiments/graphene_mypy/ mypy . | |
app/api/schema.py:8: error: No field with name "healthy" defined <------------- graphene-stubs can't find the field. | |
Found 1 error in 1 file (checked 3 source files) | |
(graphene_mypy) ~/work/zego/experiments/graphene_mypy/ cat app/api/schema.py | |
from graphene import Boolean, Field, ObjectType, ResolveInfo | |
class Query(ObjectType): | |
healthy = Field(Boolean) <------------ only this syntax makes graphene-stubs happy | |
@staticmethod | |
def resolve_healthy(_: None, __: ResolveInfo) -> bool: | |
return True | |
(graphene_mypy) ~/work/zego/experiments/graphene_mypy/ mypy . | |
Success: no issues found in 3 source files <------------------ no errors. wat? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment