graphql icon indicating copy to clipboard operation
graphql copied to clipboard

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

Open chirino opened this issue 4 years ago • 5 comments

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.

chirino avatar Aug 03 '21 18:08 chirino

Coverage Status

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

coveralls avatar Aug 03 '21 18:08 coveralls

@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 ?

chris-ramon avatar Aug 21 '21 23:08 chris-ramon

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

chirino avatar Aug 22 '21 16:08 chirino

@chris-ramon what about this new version?

chirino avatar Aug 25 '21 15:08 chirino

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?

bhoriuchi avatar Aug 30 '21 22:08 bhoriuchi