Add GraphQL Extensions (#184)
This enables accessing the Extensions field, as defined in the response format: https://spec.graphql.org/October2021/#sec-Response-Format Extensions can be enabled using configuration option use_extensions. This will change the return parameters of the generated client functions. Making it a breaking change if enabled. Since extensions are untyped as defined in the spec, the Client will return an interface of type map[string]interface{}.
This commit is contained in:
@@ -23,10 +23,12 @@ When releasing a new version:
|
||||
### 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.
|
||||
|
||||
### New features:
|
||||
|
||||
- genqlient can now run as a portable binary (i.e. without a local checkout of the repository or `go run`).
|
||||
- You can now enable `use_extensions` in the configuration file, to receive extensions returned by the GraphQL API server. Generated functions will return extensions as `map[string]interface{}`, if enabled.
|
||||
|
||||
### Bug fixes:
|
||||
|
||||
|
||||
@@ -87,6 +87,16 @@ client_getter: "github.com/you/yourpkg.GetClient"
|
||||
# Defaults to false.
|
||||
use_struct_references: boolean
|
||||
|
||||
# If set, generated code will have a third return parameter of type
|
||||
# map[string]interface{}. This will contain the optional values
|
||||
# of the Extensions field send from Servers.
|
||||
# ref.: https://spec.graphql.org/October2021/#sec-Response-Format
|
||||
#
|
||||
# This can be useful for extending the GraphQL Protocol.
|
||||
#
|
||||
# Defaults to false.
|
||||
use_extensions: boolean
|
||||
|
||||
|
||||
# A map from GraphQL type name to Go fully-qualified type name to override
|
||||
# the Go type genqlient will use for this GraphQL type.
|
||||
|
||||
Reference in New Issue
Block a user