Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ When releasing a new version:

### Breaking changes:

### New features:

### Bug fixes:

## v0.5.0

Version 0.5.0 adds several new configuration options and convenience features. Note that genqlient now requires Go 1.16 or higher, and is tested through Go 1.18.

### Breaking changes:

- genqlient now requires Go 1.16 or higher.
- The [`graphql.Client`](https://pkg.go.dev/github.com/Khan/genqlient/graphql#Client) interface now accepts two structs for the request and response, to allow future expansion, rather than several individual arguments. Clients implementing the interface themselves will need to change the signature; clients who simply call `graphql.NewClient` are unaffected.

Expand Down
11 changes: 2 additions & 9 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,10 @@ func (g *generator) preprocessQueryDocument(doc *ast.QueryDocument) {
// considers valid but we don't allow, and returns an error if this operation
// is invalid for genqlient's purposes.
func (g *generator) validateOperation(op *ast.OperationDefinition) error {
opType, err := g.baseTypeForOperation(op.Operation)
switch {
case err != nil:
_, err := g.baseTypeForOperation(op.Operation)
if err != nil {
// (e.g. operation has subscriptions, which we don't support)
return err
case opType == nil:
// gqlparser should err here, but doesn't [1], so we err to prevent
// panics later.
// TODO(benkraft): Remove once gqlparser is fixed.
// [1] https://github.com/vektah/gqlparser/issues/221
return errorf(op.Position, "schema has no %v type", op.Operation)
}

if op.Name == "" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
testdata/errors/NoMutationType.graphql:1: schema has no mutation type
testdata/errors/NoMutationType.graphql:1: query-spec does not match schema: Schema does not support operation type "mutation"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
testdata/errors/NoQueryType.graphql:1: schema has no query type
testdata/errors/NoQueryType.graphql:1: query-spec does not match schema: Schema does not support operation type "query"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/alexflint/go-arg v1.4.2
github.com/bradleyjkemp/cupaloy/v2 v2.6.0
github.com/stretchr/testify v1.7.0
github.com/vektah/gqlparser/v2 v2.4.1
github.com/vektah/gqlparser/v2 v2.4.5
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/tools v0.1.10
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.