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:
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net/http/httptest"
|
||||
|
||||
"github.com/99designs/gqlgen/graphql"
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/99designs/gqlgen/graphql/handler/transport"
|
||||
)
|
||||
@@ -131,6 +132,10 @@ func (r *queryResolver) Fail(ctx context.Context) (*bool, error) {
|
||||
func RunServer() *httptest.Server {
|
||||
gqlgenServer := handler.New(NewExecutableSchema(Config{Resolvers: &resolver{}}))
|
||||
gqlgenServer.AddTransport(transport.POST{})
|
||||
gqlgenServer.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response {
|
||||
graphql.RegisterExtension(ctx, "foobar", "test")
|
||||
return next(ctx)
|
||||
})
|
||||
return httptest.NewServer(gqlgenServer)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user