graphql-go / graphql-go/graphql

Add pointer support to resolve struct

Open
#139 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

Hi, what about pointers in struct, which resolves:
`type Todo struct {`
`Text *string 'json:"text"'`
`}`

`Resolve: func(params graphql.ResolveParams) (interface{}, error) {`
`var text = "text1"`
`return Todo{Text:&text}`
`}`
Now, graphql returns "pointer as string", because the serialize function looks:
`fmt.Sprintf("%v", value)`

I think, it is not the right way, what about this fix?

https://github.com/graphql-go/graphql/commit/d3df014b0d6417430740da6e4fd5b75cfa862ffe

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.