I am building graphQL schema using graphene and static type checking with mypy. The code for schema starts like below:
from typing import Dict, List, NamedTuple, Union
import graphene
class PossibleAnswer(graphene.ObjectType):
"""Object representing single possible answer, a pair of key and text."""
paId = graphene.String(
description="Answer id, automatically generated sequence number.")
text = graphene.String(description="Answer text, in requested language")
When I run mypy check with --ignore-missing-imports --strict
options I get error:
error: Class cannot subclass 'ObjectType' (has type 'Any')
I found a workaround put a # type: ignore
to silence the error, but I need to solve this, not mute. Changing mypy options is not an option.
How can I tell mypy that this is graphene type, not Any
type of the object I am creating?