Hello.
Django 2.0.7, Python 3.6.1
I get some strange warning at PyCharm 2018.2:
Expected type 'GraphQLObjectType', got 'Type[Query]' instead ...
Inspection info: This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations.

But everything is working great!
# core/schema.py
import graphene
from projects.schema import Query as ProjectQuery
class Query(ProjectQuery, graphene.ObjectType):
pass
schema = graphene.Schema(query=Query)
# projects/schema.py
import graphene
from graphene_django.types import DjangoObjectType
from .models import Project
class ProjectType(DjangoObjectType):
class Meta:
model = Project
interfaces = (graphene.Node,)
class Query(graphene.ObjectType):
all_projects = graphene.List(ProjectType)
def resolve_all_projects(self, info, **kwargs):
return Project.objects.all()
What's wrong? How to solve it?
Thanks!
Does the code still run? I.e., is this just an error in the way the IDE is checking types?
What is the construction of ProjectQuery?
@jayhale the codes still run, and yes, it is just a warning message from PyCharm.
P.S. problem still exists in the latest PyCharm 2018.2
PyCharm 2018.3.5 is here, but this warning is still here too...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
2019.3 still has this warning issue.
schema = graphene.Schema(query=Query, mutation=Mutation)
Expected type 'ObjectType', got 'Type[Query]' instead
Strange enough only Query does it, the Mutation type is ok.
The types:
class Query(graphene.ObjectType):
actor = graphene.Field(ActorType, id=graphene.Int())
movie = graphene.Field(MovieType, id=graphene.Int())
actors = graphene.List(ActorType)
movies = graphene.List(MovieType)
...methods are removed for brevity.
class Mutation(graphene.ObjectType):
create_actor = CreateActor.Field()
update_actor = UpdateActor.Field()
create_movie = CreateMovie.Field()
update_movie = UpdateMovie.Field()
Most helpful comment
@jayhale the codes still run, and yes, it is just a warning message from PyCharm.
P.S. problem still exists in the latest PyCharm 2018.2