Skip to content

"Expected value of type \"Visit\" but got: Visit." #599

Closed
@threewordphrase

Description

@threewordphrase

Hello, I have a very strange issue. Just playing around with GraphQL in an existing project. Here is my schema:

import graphene
from graphene_django.types import DjangoObjectType

from ops.models import Visit as VisitModel

class Visit(DjangoObjectType):
    class Meta:
        model = VisitModel

class Query(graphene.ObjectType):
    visits = graphene.List(Visit)

    def resolve_visits(self, info):
        return VisitModel.objects.all()

schema = graphene.Schema(query=Query)

Query:

{
  visits {
  	createdAt
  }
}

Output:

{
  "errors": [
    {
      "message": "Expected value of type \"Visit\" but got: Visit.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    },
    {
      "message": "Expected value of type \"Visit\" but got: Visit.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    },
    {
      "message": "Expected value of type \"Visit\" but got: Visit.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    },

FWIW, these are Proxy Models, not sure if that matters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions