Skip to content

Commit

Permalink
Document second breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjkraft committed Sep 17, 2021
1 parent 5fd1736 commit d344208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ When releasing a new version:
### Breaking changes:

- The [`graphql.Client`](https://pkg.go.dev/github.com/Khan/genqlient/graphql#Client) interface now accepts `variables interface{}` (containing a JSON-marshalable value) rather than `variables map[string]interface{}`. Clients implementing the interface themselves will need to change the signature; clients who simply call `graphql.NewClient` are unaffected.
- genqlient's handling of the `omitempty` option has changed to match that of `encoding/json`, from which it had inadvertently differed. In particular, this means struct-typed arguments with `# @genqlient(omitempty: true)` will no longer be omitted if they are the zero value. (Struct-pointers are still omitted if nil, so adding `pointer: true` will typically work fine.)

### New features:

### Bug fixes:

- The `omitempty` option now works correctly for struct- and map-typed variables, which is to say it never considers them empty (matching `encoding/json`). (#43)
- The `omitempty` option now works correctly for struct- and map-typed variables, matching `encoding/json`, which is to say it never omits structs, and omits empty maps.

## v0.1.0

Expand Down
3 changes: 3 additions & 0 deletions generate/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ func (typ *goStructType) WriteDefinition(w io.Writer, g *generator) error {
// select the same field, or several fragments select the same field -- the
// JSON library will only fill one of those (the least-nested one); we want
// to fill them all.
//
// TODO(benkraft): If/when proposal #5901 is implemented (Go 1.18 at the
// earliest), we may be able to do some of this a simpler way.
if !needUnmarshaler {
return nil
}
Expand Down

0 comments on commit d344208

Please sign in to comment.