Closed
Description
Expected Behavior
As implemented via graphql/graphql-spec#373, the GraphQL draft specification now indicates that schema definitions can include interfaces that implement other interfaces. As an example, the following should be considered valid schema definition syntax and thus be parsed successfully by the ParseSchema
and MustParseSchema
functions:
interface Node {
id: ID!
}
interface Resource implements Node {
id: ID!
url: String
}
Actual Behavior
However, it appears that this syntax is not yet supported with the current version of the graph-gophers/graphql-go
package (v0.0.0-20201027172035-4c772c181653
).
Attempting to parse a schema definition using this new syntax results in an error:
...
panic: graphql: syntax error: unexpected "implements", expecting "{" (line 10, column 20)
...
Reproduction Code (Go Playground)
package main
import "github.com/graph-gophers/graphql-go"
const schema = `
type Query {
node: Node!
}
interface Node {
id: ID!
}
interface Resource implements Node {
id: ID!
url: String
}
`
type resolver struct{}
func (_ *resolver) Node() *node {
return &node{}
}
type node struct{}
func (_ *node) ID() graphql.ID {
return graphql.ID("foo")
}
func (n *node) ToResource() (*resource, bool) {
return &resource{n}, true
}
type resource struct {
*node
}
func (_ *resource) URL() *string {
u := "https://github.com/graph-gophers/graphql-go"
return &u
}
func main() {
graphql.MustParseSchema(schema, &resolver{})
}
Any chance that y'all could add support for the interfaces implementing interfaces syntax?
Thank you in advance and for the great framework!