Files
genqlient/docs/CHANGELOG.md
T
Ben Kraft 6e2b1a5811 Fix broken behavior for several options on the same node (#105)
## Summary:
Previously, we actually allowed you to put several genqlient directives
on the same node, but the semantics were undocumented (and somewhat
confusing, when it comes to `typename`).  In order to support directives
on input options, we're actually going to be encouraging this usage (see
notes in #14), so it's time to fix it.  To avoid confusion, I just had
conflicting directives be an error, rather than defining which one
"wins".  The same applies to specifying the same option several
times in one directive.

I also fixed two small bugs:
- `typename` on an operation would incorrectly cascade down to
  all input types in a query (causing conflicts).
- directive parse errors had useless positions, now they're correct

## Test plan:
make check


Author: benjaminjkraft

Reviewers: StevenACoffman, dnerdy, aberkan, jvoll, mahtabsabet, MiguelCastillo

Required Reviewers: 

Approved By: StevenACoffman, dnerdy

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/105
2021-09-24 11:16:46 -07:00

2.0 KiB

Changelog

next

Breaking changes:

  • The 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. It's also now possible to use a custom marshaler to explicitly map zero to null.)

New features:

  • The new bindings.marshaler and bindings.unmarshaler options in genqlient.yaml allow binding to a type without using its standard JSON serialization; see the documentation for details.
  • Multiple genqlient directives may now be applied to the same node, as long as they don't conflict; see the directive documentation for details.

Bug fixes:

  • 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. (#43)
  • Generated type-names now abbreviate across multiple components; for example if the path to a type is (MyOperation, Outer, Outer, Inner, OuterInner), it will again be called MyOperationOuterInner. (This regressed in a pre-v0.1.0 refactor.) (#109)

v0.1.0

First open-sourced version.