graphql-go / graphql-go/graphql

Enhancement: BindFields should handle graphql: tag

Open
#472 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

The `graphql.BindField()` function only respects the `json:` tag. It would be useful if you could specify a different tag for graphql serialization.

Something like

```
type BaseStream struct {
OriginalSize int32 `json:"original_size" graphql:"originalSize"`
Resolution string `json:"resolution"`
SeriesType string `json:"series_type" graphql:"seriesType"`
}
```

Right now after creating an object with BindFields you get:

```
original_size: Int
resolution: String
series_type: String
```

This makes it possible to use a single model object to read a network request then modify it for GraphqQL serialisation.

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.