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:
Jan-Hendrik Boll
2022-03-30 13:48:01 -07:00
committed by GitHub
parent e81d19c8be
commit b2422452a1
63 changed files with 1792 additions and 951 deletions
@@ -178,16 +178,9 @@ func CustomMarshal(
client graphql.Client,
date time.Time,
) (*CustomMarshalResponse, error) {
__input := __CustomMarshalInput{
Date: date,
}
var err error
var retval CustomMarshalResponse
err = client.MakeRequest(
nil,
"CustomMarshal",
`
req := &graphql.Request{
OpName: "CustomMarshal",
Query: `
query CustomMarshal ($date: Date!) {
usersBornOn(date: $date) {
id
@@ -195,9 +188,21 @@ query CustomMarshal ($date: Date!) {
}
}
`,
&retval,
&__input,
Variables: &__CustomMarshalInput{
Date: date,
},
}
var err error
var data CustomMarshalResponse
resp := &graphql.Response{Data: &data}
err = client.MakeRequest(
nil,
req,
resp,
)
return &retval, err
return &data, err
}