graphql-go icon indicating copy to clipboard operation
graphql-go copied to clipboard

validation: interface implements a type

Open bsr203 opened this issue 9 years ago • 0 comments

Hello,

I had this code, and which didn't raise any error at server.

interface Node {
  id: ID!
}

type Viewer implements Node {
  # id: ID!
  widgets(first: Int, q: String): WidgetConnection!
}

but, graphiql raised an error .

Error: "Node" expects field "id" but "Viewer" does not provide it.
    at invariant (http://localhost:8082/index.js:25961:12)
    at http://localhost:8082/index.js:26453:30
    at Array.forEach (native)
    at assertObjectImplementsInterface (http://localhost:8082/index.js:26448:31)
    at http://localhost:8082/index.js:26326:19
    at Array.forEach (native)
    at http://localhost:8082/index.js:26325:31
    at Array.forEach (native)
    at new GraphQLSchema (http://localhost:8082/index.js:26322:33)
    at buildClientSchema (http://localhost:8082/index.js:33920:11)

This also good to catch at schema build time.

thanks.

bsr203 avatar Nov 22 '16 22:11 bsr203