diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 692d7dde..15986196 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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. diff --git a/generate/generate.go b/generate/generate.go index 6af6cf1d..cb5acf49 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -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 == "" { diff --git a/generate/testdata/snapshots/TestGenerateErrors-NoMutationType-graphql b/generate/testdata/snapshots/TestGenerateErrors-NoMutationType-graphql index 2c40a67d..573149ab 100644 --- a/generate/testdata/snapshots/TestGenerateErrors-NoMutationType-graphql +++ b/generate/testdata/snapshots/TestGenerateErrors-NoMutationType-graphql @@ -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" diff --git a/generate/testdata/snapshots/TestGenerateErrors-NoQueryType-graphql b/generate/testdata/snapshots/TestGenerateErrors-NoQueryType-graphql index aa00a565..779db1bf 100644 --- a/generate/testdata/snapshots/TestGenerateErrors-NoQueryType-graphql +++ b/generate/testdata/snapshots/TestGenerateErrors-NoQueryType-graphql @@ -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" diff --git a/go.mod b/go.mod index 14462c80..1531ea44 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 6676044a..e519639c 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= -github.com/vektah/gqlparser/v2 v2.4.1 h1:QOyEn8DAPMUMARGMeshKDkDgNmVoEaEGiDB0uWxcSlQ= -github.com/vektah/gqlparser/v2 v2.4.1/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= +github.com/vektah/gqlparser/v2 v2.4.5 h1:C02NsyEsL4TXJB7ndonqTfuQOL4XPIu0aAWugdmTgmc= +github.com/vektah/gqlparser/v2 v2.4.5/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=