absinthe-graphql / absinthe_tutorial

Absinthe v1.4 Tutorial Code
MIT License
71 stars 31 forks source link

can't get the contact data #6

Closed mydearxym closed 6 years ago

mydearxym commented 6 years ago

query contacts in graphql-playground get error

{
  user(id: 1) {
    name
    contacts {
      type
    }
  }
}
{
  "errors": [
    {
      "path": [
        "user",
        "contacts",
        0,
        "type"
      ],
      "message": "Cannot return null for non-nullable field",
      "locations": []
    }
  ],
  "data": {
    "user": {
      "name": "Test",
      "contacts": [
        null
      ]
    }
  }
}

but query post seems right

{
  user(id: 1) {
    name
    posts {
      title
    }
  }
}
{
  "data": {
    "user": {
      "posts": [
        {
          "title": "Test Post"
        }
      ],
      "name": "Test"
    }
  }
}

PS: already insert the seed data

mydearxym commented 6 years ago

figured.