From 873aaec785fb11b1c491518e053af88b0f455a91 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Fri, 6 Oct 2023 06:24:54 +0000 Subject: [PATCH] chore(deps): bump github.com/99designs/gqlgen from 0.17.38 to 0.17.39 Bumps [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) from 0.17.38 to 0.17.39. - [Release notes](https://github.com/99designs/gqlgen/releases) - [Changelog](https://github.com/99designs/gqlgen/blob/master/CHANGELOG.md) - [Commits](https://github.com/99designs/gqlgen/compare/v0.17.38...v0.17.39) --- .pre-commit-config.yaml | 2 +- ctl/generated.go | 46 +++++++++++++++++++----------------- go.mod | 3 ++- go.sum | 6 +++-- graph/generated/generated.go | 10 ++++++-- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef2ff50..554026c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,4 +40,4 @@ repos: rev: v1.54.2 hooks: - id: golangci-lint -exclude: '^graph/generated/.*$|^graph/model/models_gen.go|^tools/.*$$' +exclude: '^ctl/generated.go|graph/generated/.*$|^graph/model/models_gen.go|^tools/.*$$' diff --git a/ctl/generated.go b/ctl/generated.go index a1b26c6..71be428 100644 --- a/ctl/generated.go +++ b/ctl/generated.go @@ -43,6 +43,7 @@ type SubGraphsResponse struct { func (v *SubGraphsResponse) GetSupergraph() SubGraphsSupergraph { return v.Supergraph } func (v *SubGraphsResponse) UnmarshalJSON(b []byte) error { + if string(b) == "null" { return nil } @@ -148,6 +149,7 @@ func __unmarshalSubGraphsSupergraph(b []byte, v *SubGraphsSupergraph) error { } func __marshalSubGraphsSupergraph(v *SubGraphsSupergraph) ([]byte, error) { + var typename string switch v := (*v).(type) { case *SubGraphsSupergraphSubGraphs: @@ -289,29 +291,29 @@ query SubGraphs ($ref: String!) { ` func SubGraphs( - ctx context.Context, - client graphql.Client, + ctx_ context.Context, + client_ graphql.Client, ref string, ) (*SubGraphsResponse, error) { - req := &graphql.Request{ + req_ := &graphql.Request{ OpName: "SubGraphs", Query: SubGraphs_Operation, Variables: &__SubGraphsInput{ Ref: ref, }, } - var err error + var err_ error - var data SubGraphsResponse - resp := &graphql.Response{Data: &data} + var data_ SubGraphsResponse + resp_ := &graphql.Response{Data: &data_} - err = client.MakeRequest( - ctx, - req, - resp, + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, ) - return &data, err + return &data_, err_ } // The query or mutation executed by UpdateSubGraph. @@ -328,27 +330,27 @@ mutation UpdateSubGraph ($input: InputSubGraph!) { ` func UpdateSubGraph( - ctx context.Context, - client graphql.Client, + ctx_ context.Context, + client_ graphql.Client, input *InputSubGraph, ) (*UpdateSubGraphResponse, error) { - req := &graphql.Request{ + req_ := &graphql.Request{ OpName: "UpdateSubGraph", Query: UpdateSubGraph_Operation, Variables: &__UpdateSubGraphInput{ Input: input, }, } - var err error + var err_ error - var data UpdateSubGraphResponse - resp := &graphql.Response{Data: &data} + var data_ UpdateSubGraphResponse + resp_ := &graphql.Response{Data: &data_} - err = client.MakeRequest( - ctx, - req, - resp, + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, ) - return &data, err + return &data_, err_ } diff --git a/go.mod b/go.mod index d04670a..cbfc3a8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module gitlab.com/unboundsoftware/schemas go 1.19 require ( - github.com/99designs/gqlgen v0.17.38 + github.com/99designs/gqlgen v0.17.39 github.com/Khan/genqlient v0.6.0 github.com/alecthomas/kong v0.8.0 github.com/apex/log v1.9.0 @@ -40,6 +40,7 @@ require ( github.com/rabbitmq/amqp091-go v1.9.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect + github.com/sosodev/duration v1.1.0 // indirect github.com/tidwall/gjson v1.14.3 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect diff --git a/go.sum b/go.sum index 2c98a49..ae06a28 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/99designs/gqlgen v0.17.38 h1:3r7G7i8UAdY0iYreNiBAA55auVsrowO0+ZhMl5g4GYU= -github.com/99designs/gqlgen v0.17.38/go.mod h1:2v+dKtpI8mIzYeW9dYN8mO69tMmjszW2xKLNcWR/5wQ= +github.com/99designs/gqlgen v0.17.39 h1:wPTAyc2fqVjAWT5DsJ21k/lLudgnXzURwbsjVNegFpU= +github.com/99designs/gqlgen v0.17.39/go.mod h1:b62q1USk82GYIVjC60h02YguAZLqYZtvWml8KkhJps4= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/Khan/genqlient v0.6.0 h1:Bwb1170ekuNIVIwTJEqvO8y7RxBxXu639VJOkKSrwAk= @@ -120,6 +120,8 @@ github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= +github.com/sosodev/duration v1.1.0 h1:kQcaiGbJaIsRqgQy7VGlZrVw1giWO+lDoX3MCPnpVO4= +github.com/sosodev/duration v1.1.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/sparetimecoders/goamqp v0.1.3/go.mod h1:BKUl32yHsxpKEZEn7oEgyKB8Y0C4dk5n+17FModO6iM= github.com/sparetimecoders/goamqp v0.2.0 h1:S1oJ2NUJxoTBSfRx5BsKb1eKRaNninm301neym5bzrs= github.com/sparetimecoders/goamqp v0.2.0/go.mod h1:TWWNPccknku8b6xA8nLb76ll882zQw6TXzophis3+2k= diff --git a/graph/generated/generated.go b/graph/generated/generated.go index e5792c2..744f489 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -24,6 +24,7 @@ import ( // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ + schema: cfg.Schema, resolvers: cfg.Resolvers, directives: cfg.Directives, complexity: cfg.Complexity, @@ -31,6 +32,7 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { } type Config struct { + Schema *ast.Schema Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot @@ -111,12 +113,16 @@ type QueryResolver interface { } type executableSchema struct { + schema *ast.Schema resolvers ResolverRoot directives DirectiveRoot complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } return parsedSchema } @@ -444,14 +450,14 @@ func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") } - return introspection.WrapSchema(parsedSchema), nil + return introspection.WrapSchema(ec.Schema()), nil } func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") } - return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } var sources = []*ast.Source{ -- 2.52.0