graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.91k stars 839 forks source link

Update Schema #516

Open jcantonio opened 5 years ago

jcantonio commented 5 years ago

Hello, First thanks for this great project. I ran into the issue when updating a schema. For an update, I first remove the type then add the new one

delete(schema.TypeMap(), resourceType.Name())
schema.AppendType(resourceType)

It works when the schema doe not contain a field of type object. But when using an object, it seems that updates have a collision name, as it returns the error:

Schema must contain unique named types but contains multiple types named "objectA". See code sample: https://play.golang.org/p/N8iBmXzG-U1

Kind regards,

jcantonio commented 5 years ago

Hi, I just provided a pull request to fix it: https://github.com/graphql-go/graphql/pull/518 Cheers, JClaude