graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.94k stars 841 forks source link

fix: issue #65: type of ResolveInfo.RootValue should be interface{} #608

Open chirino opened 3 years ago

chirino commented 3 years ago

changes type of ResolveInfo.RootValue ot be interface{}

I would like to set the RootObject to a struct pointer that my resolvers would rather deal with.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.4%) to 92.427% when pulling bca2f15dcfaf83b357832694e02d3ebd0551cc26 on chirino:issue-65 into f02a1c961028d3ba7ac6bb22eaa09b31a2cb53dd on graphql-go:master.

chris-ramon commented 3 years ago

@chirino thanks for filing a PR — I don't think we should be changing this end-user type: graphql.Params.RootObject because it would be an API breaking-change.

An alternative strategy would be to have a small wrapper around your resolvers that consolidates map[string]interface{} to interface{} on your end ?

chirino commented 3 years ago

To avoid the breaking change we could Introduce a new field and deprecate RootValue and ask folks to stop using RootValue.

chirino commented 3 years ago

@chris-ramon what about this new version?

bhoriuchi commented 3 years ago

RootValue is part of the spec, I don't think deprecating it is a good idea.

That said, will changing it to interface{} actually break it? map[string]interface{} can be assigned to an interface value no?