From 9f85161930220becde384662e4da9f4b457ce19f Mon Sep 17 00:00:00 2001 From: frederikhors <41120635+frederikhors@users.noreply.github.com> Date: Tue, 20 Oct 2020 19:46:58 +0200 Subject: [PATCH 01/50] add uint, uint64, uint32 types in graphql --- graphql/uint.go | 81 ++++++++++++++++++++++++++++++++++++++++++++ graphql/uint_test.go | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 graphql/uint.go create mode 100644 graphql/uint_test.go diff --git a/graphql/uint.go b/graphql/uint.go new file mode 100644 index 00000000000..9349c2f4d24 --- /dev/null +++ b/graphql/uint.go @@ -0,0 +1,81 @@ +package graphql + +import ( + "encoding/json" + "fmt" + "io" + "strconv" +) + +func MarshalUint(i uint) Marshaler { + return WriterFunc(func(w io.Writer) { + _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) + }) +} + +func UnmarshalUint(v interface{}) (uint, error) { + switch v := v.(type) { + case string: + u64, err := strconv.ParseUint(v, 10, 64) + return uint(u64), err + case int: + return uint(v), nil + case int64: + return uint(v), nil + case json.Number: + u64, err := strconv.ParseUint(string(v), 10, 64) + return uint(u64), err + default: + return 0, fmt.Errorf("%T is not an uint", v) + } +} + +func MarshalUint64(i uint64) Marshaler { + return WriterFunc(func(w io.Writer) { + _, _ = io.WriteString(w, strconv.FormatUint(i, 10)) + }) +} + +func UnmarshalUint64(v interface{}) (uint64, error) { + switch v := v.(type) { + case string: + return strconv.ParseUint(v, 10, 64) + case int: + return uint64(v), nil + case int64: + return uint64(v), nil + case json.Number: + return strconv.ParseUint(string(v), 10, 64) + default: + return 0, fmt.Errorf("%T is not an uint", v) + } +} + +func MarshalUint32(i uint32) Marshaler { + return WriterFunc(func(w io.Writer) { + _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) + }) +} + +func UnmarshalUint32(v interface{}) (uint32, error) { + switch v := v.(type) { + case string: + iv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + return 0, err + } + return uint32(iv), nil + case int: + return uint32(v), nil + case int64: + return uint32(v), nil + case json.Number: + iv, err := strconv.ParseUint(string(v), 10, 32) + if err != nil { + return 0, err + } + return uint32(iv), nil + default: + return 0, fmt.Errorf("%T is not an uint", v) + } +} diff --git a/graphql/uint_test.go b/graphql/uint_test.go new file mode 100644 index 00000000000..98f08ef5261 --- /dev/null +++ b/graphql/uint_test.go @@ -0,0 +1,71 @@ +package graphql + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestUint(t *testing.T) { + t.Run("marshal", func(t *testing.T) { + assert.Equal(t, "123", m2s(MarshalUint(123))) + }) + + t.Run("unmarshal", func(t *testing.T) { + assert.Equal(t, uint(123), mustUnmarshalUint(123)) + assert.Equal(t, uint(123), mustUnmarshalUint(int64(123))) + assert.Equal(t, uint(123), mustUnmarshalUint(json.Number("123"))) + assert.Equal(t, uint(123), mustUnmarshalUint("123")) + }) +} + +func mustUnmarshalUint(v interface{}) uint { + res, err := UnmarshalUint(v) + if err != nil { + panic(err) + } + return res +} + +func TestUint32(t *testing.T) { + t.Run("marshal", func(t *testing.T) { + assert.Equal(t, "123", m2s(MarshalUint32(123))) + }) + + t.Run("unmarshal", func(t *testing.T) { + assert.Equal(t, uint32(123), mustUnmarshalUint32(123)) + assert.Equal(t, uint32(123), mustUnmarshalUint32(int64(123))) + assert.Equal(t, uint32(123), mustUnmarshalUint32(json.Number("123"))) + assert.Equal(t, uint32(123), mustUnmarshalUint32("123")) + }) +} + +func mustUnmarshalUint32(v interface{}) uint32 { + res, err := UnmarshalUint32(v) + if err != nil { + panic(err) + } + return res +} + +func TestUint64(t *testing.T) { + t.Run("marshal", func(t *testing.T) { + assert.Equal(t, "123", m2s(MarshalUint64(123))) + }) + + t.Run("unmarshal", func(t *testing.T) { + assert.Equal(t, uint64(123), mustUnmarshalUint64(123)) + assert.Equal(t, uint64(123), mustUnmarshalUint64(int64(123))) + assert.Equal(t, uint64(123), mustUnmarshalUint64(json.Number("123"))) + assert.Equal(t, uint64(123), mustUnmarshalUint64("123")) + }) +} + +func mustUnmarshalUint64(v interface{}) uint64 { + res, err := UnmarshalUint64(v) + if err != nil { + panic(err) + } + return res +} From 918801eac861c0ceb5cf45969745f674b823ef7c Mon Sep 17 00:00:00 2001 From: Ricardo Cuenca Date: Fri, 11 Dec 2020 19:21:22 -0600 Subject: [PATCH 02/50] Change 'Changeset' doc example to mutation --- docs/content/reference/changesets.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/reference/changesets.md b/docs/content/reference/changesets.md index 243ab30eb6a..329206ba5ef 100644 --- a/docs/content/reference/changesets.md +++ b/docs/content/reference/changesets.md @@ -9,7 +9,7 @@ Occasionally you need to distinguish presence from nil (undefined vs null). In g ```graphql -type Query { +type Mutation { updateUser(id: ID!, changes: UserChanges!): User } @@ -28,7 +28,7 @@ models: After running go generate you should end up with a resolver that looks like this: ```go -func (r *queryResolver) UpdateUser(ctx context.Context, id int, changes map[string]interface{}) (*User, error) { +func (r *mutationResolver) UpdateUser(ctx context.Context, id int, changes map[string]interface{}) (*User, error) { u := fetchFromDb(id) /// apply the changes saveToDb(u) From 5ef5d14f864eb355ffb96d2727a19b61c5d2b362 Mon Sep 17 00:00:00 2001 From: Braeden Lisowski <47958989+lisowskibraeden@users.noreply.github.com> Date: Sat, 23 Jan 2021 19:23:58 -0600 Subject: [PATCH 03/50] Update cors.md I had problems reading this page and applying it to my project. With these changes it worked on my end --- docs/content/recipes/cors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/content/recipes/cors.md b/docs/content/recipes/cors.md index 9e36110e7e7..0b0ac114bfa 100644 --- a/docs/content/recipes/cors.md +++ b/docs/content/recipes/cors.md @@ -22,6 +22,8 @@ import ( "github.com/99designs/gqlgen/graphql/handler" "github.com/go-chi/chi" "github.com/rs/cors" + "github.com/gorilla/websocket" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { @@ -48,7 +50,7 @@ func main() { }, }) - router.Handle("/", handler.Playground("Starwars", "/query")) + router.Handle("/", playground.Handler("Starwars", "/query")) router.Handle("/query", srv) err := http.ListenAndServe(":8080", router) From 478c3f08b20fadd31c538ddd90bb7e88a4e2c1a9 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Wed, 27 Jan 2021 21:47:14 +0700 Subject: [PATCH 04/50] feat(codegen): handle (v, ok) methods --- codegen/field.go | 3 + codegen/field.gotpl | 8 +- codegen/testserver/generated.go | 261 ++++++++++++++++++++++++++++++++ codegen/testserver/resolver.go | 8 + codegen/testserver/stub.go | 8 + codegen/testserver/v-ok.go | 17 +++ codegen/testserver/v-ok.graphql | 12 ++ codegen/testserver/v-ok_test.go | 47 ++++++ 8 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 codegen/testserver/v-ok.go create mode 100644 codegen/testserver/v-ok.graphql create mode 100644 codegen/testserver/v-ok_test.go diff --git a/codegen/field.go b/codegen/field.go index 26ed6b5518a..d1eceb002ef 100644 --- a/codegen/field.go +++ b/codegen/field.go @@ -25,6 +25,7 @@ type Field struct { Args []*FieldArgument // A list of arguments to be passed to this field MethodHasContext bool // If this is bound to a go method, does the method also take a context NoErr bool // If this is bound to a go method, does that method have an error as the second argument + VOkFunc bool // If this is bound to a go method, is it of shape (interface{}, bool) Object *Object // A link back to the parent object Default interface{} // The default value Stream bool // does this field return a channel? @@ -152,6 +153,8 @@ func (b *builder) bindField(obj *Object, f *Field) (errret error) { sig := target.Type().(*types.Signature) if sig.Results().Len() == 1 { f.NoErr = true + } else if s := sig.Results(); s.Len() == 2 && s.At(1).Type().String() == "bool" { + f.VOkFunc = true } else if sig.Results().Len() != 2 { return fmt.Errorf("method has wrong number of args") } diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 66f715981a6..8e53772afac 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -112,7 +112,13 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ .Name | quote}}) } {{- else if .IsMethod -}} - {{- if .NoErr -}} + {{- if .VOkFunc -}} + v, ok := {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}) + if !ok { + return nil, nil + } + return v, nil + {{- else if .NoErr -}} return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}), nil {{- else -}} return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index ea3c2f48547..c11404c472b 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -306,6 +306,8 @@ type ComplexityRoot struct { Shapes func(childComplexity int) int Slices func(childComplexity int) int User func(childComplexity int, id int) int + VOkCaseNil func(childComplexity int) int + VOkCaseValue func(childComplexity int) int Valid func(childComplexity int) int ValidType func(childComplexity int) int WrappedMap func(childComplexity int) int @@ -344,6 +346,14 @@ type ComplexityRoot struct { Updated func(childComplexity int) int } + VOkCaseNil struct { + Value func(childComplexity int) int + } + + VOkCaseValue struct { + Value func(childComplexity int) int + } + ValidType struct { DifferentCase func(childComplexity int) int DifferentCaseOld func(childComplexity int) int @@ -467,6 +477,8 @@ type QueryResolver interface { ScalarSlice(ctx context.Context) ([]byte, error) Fallback(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) OptionalUnion(ctx context.Context) (TestUnion, error) + VOkCaseValue(ctx context.Context) (*VOkCaseValue, error) + VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) ValidType(ctx context.Context) (*ValidType, error) WrappedStruct(ctx context.Context) (*WrappedStruct, error) WrappedScalar(ctx context.Context) (otherpkg.Scalar, error) @@ -1445,6 +1457,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.User(childComplexity, args["id"].(int)), true + case "Query.vOkCaseNil": + if e.complexity.Query.VOkCaseNil == nil { + break + } + + return e.complexity.Query.VOkCaseNil(childComplexity), true + + case "Query.vOkCaseValue": + if e.complexity.Query.VOkCaseValue == nil { + break + } + + return e.complexity.Query.VOkCaseValue(childComplexity), true + case "Query.valid": if e.complexity.Query.Valid == nil { break @@ -1623,6 +1649,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.User.Updated(childComplexity), true + case "VOkCaseNil.value": + if e.complexity.VOkCaseNil.Value == nil { + break + } + + return e.complexity.VOkCaseNil.Value(childComplexity), true + + case "VOkCaseValue.value": + if e.complexity.VOkCaseValue.Value == nil { + break + } + + return e.complexity.VOkCaseValue.Value(childComplexity), true + case "ValidType.differentCase": if e.complexity.ValidType.DifferentCase == nil { break @@ -2235,6 +2275,19 @@ union TestUnion = A | B extend type Query { optionalUnion: TestUnion } +`, BuiltIn: false}, + {Name: "v-ok.graphql", Input: `extend type Query { + vOkCaseValue: VOkCaseValue + vOkCaseNil: VOkCaseNil +} + +type VOkCaseValue @goModel(model:"testserver.VOkCaseValue") { + value: String +} + +type VOkCaseNil @goModel(model:"testserver.VOkCaseNil") { + value: String +} `, BuiltIn: false}, {Name: "validtypes.graphql", Input: `extend type Query { validType: ValidType @@ -7534,6 +7587,64 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap return ec.marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐTestUnion(ctx, field.Selections, res) } +func (ec *executionContext) _Query_vOkCaseValue(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().VOkCaseValue(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*VOkCaseValue) + fc.Result = res + return ec.marshalOVOkCaseValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐVOkCaseValue(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_vOkCaseNil(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().VOkCaseNil(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*VOkCaseNil) + fc.Result = res + return ec.marshalOVOkCaseNil2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐVOkCaseNil(ctx, field.Selections, res) +} + func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -8429,6 +8540,72 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } +func (ec *executionContext) _VOkCaseNil_value(ctx context.Context, field graphql.CollectedField, obj *VOkCaseNil) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "VOkCaseNil", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + v, ok := obj.Value() + if !ok { + return nil, nil + } + return v, nil + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _VOkCaseValue_value(ctx context.Context, field graphql.CollectedField, obj *VOkCaseValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "VOkCaseValue", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + v, ok := obj.Value() + if !ok { + return nil, nil + } + return v, nil + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -12394,6 +12571,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr res = ec._Query_optionalUnion(ctx, field) return res }) + case "vOkCaseValue": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vOkCaseValue(ctx, field) + return res + }) + case "vOkCaseNil": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vOkCaseNil(ctx, field) + return res + }) case "validType": field := field out.Concurrently(i, func() (res graphql.Marshaler) { @@ -12620,6 +12819,54 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj return out } +var vOkCaseNilImplementors = []string{"VOkCaseNil"} + +func (ec *executionContext) _VOkCaseNil(ctx context.Context, sel ast.SelectionSet, obj *VOkCaseNil) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vOkCaseNilImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VOkCaseNil") + case "value": + out.Values[i] = ec._VOkCaseNil_value(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var vOkCaseValueImplementors = []string{"VOkCaseValue"} + +func (ec *executionContext) _VOkCaseValue(ctx context.Context, sel ast.SelectionSet, obj *VOkCaseValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vOkCaseValueImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VOkCaseValue") + case "value": + out.Values[i] = ec._VOkCaseValue_value(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var validTypeImplementors = []string{"ValidType"} func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet, obj *ValidType) graphql.Marshaler { @@ -14642,6 +14889,20 @@ func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel return graphql.MarshalTime(*v) } +func (ec *executionContext) marshalOVOkCaseNil2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐVOkCaseNil(ctx context.Context, sel ast.SelectionSet, v *VOkCaseNil) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._VOkCaseNil(ctx, sel, v) +} + +func (ec *executionContext) marshalOVOkCaseValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐVOkCaseValue(ctx context.Context, sel ast.SelectionSet, v *VOkCaseValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._VOkCaseValue(ctx, sel, v) +} + func (ec *executionContext) unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx context.Context, v interface{}) (*ValidInput, error) { if v == nil { return nil, nil diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index 952d20943e8..c9528777d0b 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -272,6 +272,14 @@ func (r *queryResolver) OptionalUnion(ctx context.Context) (TestUnion, error) { panic("not implemented") } +func (r *queryResolver) VOkCaseValue(ctx context.Context) (*VOkCaseValue, error) { + panic("not implemented") +} + +func (r *queryResolver) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) { + panic("not implemented") +} + func (r *queryResolver) ValidType(ctx context.Context) (*ValidType, error) { panic("not implemented") } diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index daf4052ea08..528cb1e7f10 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -95,6 +95,8 @@ type Stub struct { ScalarSlice func(ctx context.Context) ([]byte, error) Fallback func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) OptionalUnion func(ctx context.Context) (TestUnion, error) + VOkCaseValue func(ctx context.Context) (*VOkCaseValue, error) + VOkCaseNil func(ctx context.Context) (*VOkCaseNil, error) ValidType func(ctx context.Context) (*ValidType, error) WrappedStruct func(ctx context.Context) (*WrappedStruct, error) WrappedScalar func(ctx context.Context) (otherpkg.Scalar, error) @@ -388,6 +390,12 @@ func (r *stubQuery) Fallback(ctx context.Context, arg FallbackToStringEncoding) func (r *stubQuery) OptionalUnion(ctx context.Context) (TestUnion, error) { return r.QueryResolver.OptionalUnion(ctx) } +func (r *stubQuery) VOkCaseValue(ctx context.Context) (*VOkCaseValue, error) { + return r.QueryResolver.VOkCaseValue(ctx) +} +func (r *stubQuery) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) { + return r.QueryResolver.VOkCaseNil(ctx) +} func (r *stubQuery) ValidType(ctx context.Context) (*ValidType, error) { return r.QueryResolver.ValidType(ctx) } diff --git a/codegen/testserver/v-ok.go b/codegen/testserver/v-ok.go new file mode 100644 index 00000000000..5ad96bd5b8d --- /dev/null +++ b/codegen/testserver/v-ok.go @@ -0,0 +1,17 @@ +package testserver + +// VOkCaseValue model +type VOkCaseValue struct { +} + +func (v VOkCaseValue) Value() (string, bool) { + return "hi", true +} + +// VOkCaseNil model +type VOkCaseNil struct { +} + +func (v VOkCaseNil) Value() (string, bool) { + return "", false +} diff --git a/codegen/testserver/v-ok.graphql b/codegen/testserver/v-ok.graphql new file mode 100644 index 00000000000..0d1530f3636 --- /dev/null +++ b/codegen/testserver/v-ok.graphql @@ -0,0 +1,12 @@ +extend type Query { + vOkCaseValue: VOkCaseValue + vOkCaseNil: VOkCaseNil +} + +type VOkCaseValue @goModel(model:"testserver.VOkCaseValue") { + value: String +} + +type VOkCaseNil @goModel(model:"testserver.VOkCaseNil") { + value: String +} diff --git a/codegen/testserver/v-ok_test.go b/codegen/testserver/v-ok_test.go new file mode 100644 index 00000000000..fe7037b587d --- /dev/null +++ b/codegen/testserver/v-ok_test.go @@ -0,0 +1,47 @@ +package testserver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" +) + +func TestOk(t *testing.T) { + resolver := &Stub{} + resolver.QueryResolver.VOkCaseValue = func(ctx context.Context) (*VOkCaseValue, error) { + return &VOkCaseValue{}, nil + } + resolver.QueryResolver.VOkCaseNil = func(ctx context.Context) (*VOkCaseNil, error) { + return &VOkCaseNil{}, nil + } + + c := client.New(handler.NewDefaultServer( + NewExecutableSchema(Config{Resolvers: resolver}), + )) + + t.Run("v ok case value", func(t *testing.T) { + var resp struct { + VOkCaseValue struct { + Value string + } + } + err := c.Post(`query { vOkCaseValue { value } }`, &resp) + require.NoError(t, err) + require.Equal(t, resp.VOkCaseValue.Value, "hi") + }) + + t.Run("v ok case nil", func(t *testing.T) { + var resp struct { + VOkCaseNil struct { + Value *string + } + } + err := c.Post(`query { vOkCaseNil { value } }`, &resp) + require.NoError(t, err) + require.Equal(t, true, resp.VOkCaseNil.Value == nil) + }) +} From 0e9d9c3a9d072c6e2262bf742705d723be8d2508 Mon Sep 17 00:00:00 2001 From: sanjeevchopra Date: Wed, 27 Jan 2021 17:16:11 -0800 Subject: [PATCH 05/50] updated sample code for disabling introspection --- docs/content/reference/introspection.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/introspection.md b/docs/content/reference/introspection.md index daa26c6cb01..c1acb1e8160 100644 --- a/docs/content/reference/introspection.md +++ b/docs/content/reference/introspection.md @@ -29,7 +29,7 @@ Introspection can also be enabled on a per-request context basis. For example, y srv := handler.NewDefaultServer(es) srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { if !userForContext(ctx).IsAdmin { - graphql.GetOperationContext(ctx).DisableIntrospection = true + graphql.GetRequestContext(ctx).DisableIntrospection = true } return next(ctx) From 02b140038d1f192af2ff2cc05a08a691b300ec94 Mon Sep 17 00:00:00 2001 From: fmyd Date: Thu, 28 Jan 2021 17:53:21 +0900 Subject: [PATCH 06/50] fomatted query indent --- docs/content/getting-started.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 99a3be37270..db6ebaec1e3 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -136,7 +136,7 @@ go run server.go then open http://localhost:8080 in a browser. here are some queries to try: ```graphql mutation createTodo { - createTodo(input:{text:"todo", userId:"1"}) { + createTodo(input: { text: "todo", userId: "1" }) { user { id } @@ -146,13 +146,13 @@ mutation createTodo { } query findTodos { - todos { - text - done - user { - name - } + todos { + text + done + user { + name } + } } ``` @@ -205,7 +205,7 @@ At the top of our `resolver.go`, between `package` and `import`, add the followi //go:generate go run github.com/99designs/gqlgen ``` -This magic comment tells `go generate` what command to run when we want to regenerate our code. To run go generate recursively over your entire project, use this command: +This magic comment tells `go generate` what command to run when we want to regenerate our code. To run go generate recursively over your entire project, use this command: ```go go generate ./... From 18678b15ecbcf6075356623fbc0902606e440513 Mon Sep 17 00:00:00 2001 From: Shoichi Kaji Date: Sat, 6 Feb 2021 22:35:05 +0900 Subject: [PATCH 07/50] Fix data race The argument of unmarshalInput may be the same for concurrent use if it pass as graphql "variables". So we have to copy it before setting default values --- codegen/input.gotpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codegen/input.gotpl b/codegen/input.gotpl index e8a5b50492b..c6eac4d47bb 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -2,7 +2,10 @@ {{- if not .HasUnmarshal }} func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) { var it {{.Type | ref}} - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } {{ range $field := .Fields}} {{- if $field.Default}} if _, present := asMap[{{$field.Name|quote}}] ; !present { From 23eec79139fd4735d50d397a081edfefad09fd27 Mon Sep 17 00:00:00 2001 From: Shoichi Kaji Date: Sat, 6 Feb 2021 22:43:59 +0900 Subject: [PATCH 08/50] go generate ./... --- codegen/testserver/generated.go | 50 +++++++++++++++++----- example/config/generated.go | 5 ++- example/fileupload/generated.go | 5 ++- example/scalars/generated.go | 5 ++- example/starwars/generated/exec.go | 5 ++- example/todo/generated.go | 5 ++- example/type-system-extension/generated.go | 5 ++- integration/generated.go | 5 ++- 8 files changed, 68 insertions(+), 17 deletions(-) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index ea3c2f48547..34726a00876 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -9831,7 +9831,10 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, obj interface{}) (InnerDirectives, error) { var it InnerDirectives - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -9873,7 +9876,10 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, obj interface{}) (InnerInput, error) { var it InnerInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -9893,7 +9899,10 @@ func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, obj in func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, obj interface{}) (InputDirectives, error) { var it InputDirectives - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10013,7 +10022,10 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o func (ec *executionContext) unmarshalInputInputWithEnumValue(ctx context.Context, obj interface{}) (InputWithEnumValue, error) { var it InputWithEnumValue - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10033,7 +10045,10 @@ func (ec *executionContext) unmarshalInputInputWithEnumValue(ctx context.Context func (ec *executionContext) unmarshalInputNestedInput(ctx context.Context, obj interface{}) (NestedInput, error) { var it NestedInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10053,7 +10068,10 @@ func (ec *executionContext) unmarshalInputNestedInput(ctx context.Context, obj i func (ec *executionContext) unmarshalInputNestedMapInput(ctx context.Context, obj interface{}) (NestedMapInput, error) { var it NestedMapInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10073,7 +10091,10 @@ func (ec *executionContext) unmarshalInputNestedMapInput(ctx context.Context, ob func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, obj interface{}) (OuterInput, error) { var it OuterInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10093,7 +10114,10 @@ func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, obj in func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Context, obj interface{}) (RecursiveInputSlice, error) { var it RecursiveInputSlice - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10113,7 +10137,10 @@ func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Contex func (ec *executionContext) unmarshalInputSpecialInput(ctx context.Context, obj interface{}) (SpecialInput, error) { var it SpecialInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { @@ -10133,7 +10160,10 @@ func (ec *executionContext) unmarshalInputSpecialInput(ctx context.Context, obj func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, obj interface{}) (ValidInput, error) { var it ValidInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/config/generated.go b/example/config/generated.go index 4e985ada6b1..a00b4fb177e 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -1809,7 +1809,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, obj interface{}) (NewTodo, error) { var it NewTodo - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 9610785421c..c53925c44ba 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -1888,7 +1888,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, obj interface{}) (model.UploadFile, error) { var it model.UploadFile - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index aa21a4bd1cd..c819142b65b 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -2146,7 +2146,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, obj interface{}) (model.SearchArgs, error) { var it model.SearchArgs - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 3964d7f1069..ed9e4a4760d 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -3484,7 +3484,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, obj interface{}) (models.Review, error) { var it models.Review - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/todo/generated.go b/example/todo/generated.go index cb73c7c6c47..e1214fe3a66 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -1856,7 +1856,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj interface{}) (TodoInput, error) { var it TodoInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 2a8cc69338c..ebc4b5727d0 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -1874,7 +1874,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj interface{}) (TodoInput, error) { var it TodoInput - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } for k, v := range asMap { switch k { diff --git a/integration/generated.go b/integration/generated.go index 160d95ced50..0ff4474329d 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -2013,7 +2013,10 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, obj interface{}) (models.DateFilter, error) { var it models.DateFilter - var asMap = obj.(map[string]interface{}) + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } if _, present := asMap["timezone"]; !present { asMap["timezone"] = "UTC" From ada1b928096db2d4cff8d476e62d8a84c41da47e Mon Sep 17 00:00:00 2001 From: Aaron Arinder Date: Sun, 7 Feb 2021 14:40:35 -0500 Subject: [PATCH 09/50] getting started: updating wording around implementing unimpl fns --- docs/content/getting-started.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 99a3be37270..821efe02669 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -103,14 +103,15 @@ func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) { We just need to implement these two methods to get our server working: -First we need somewhere to track our state, lets put it in `graph/resolver.go`: +First we need somewhere to track our state, lets put it in `graph/resolver.go`. `graph/resolver.go` is where we declare any dependencies for our app, like our database. It gets initialized once in `server.go` when we create the graph. + ```go type Resolver struct{ todos []*model.Todo } ``` -This is where we declare any dependencies for our app like our database, it gets initialized once in `server.go` when -we create the graph. + +Returning to `graph/schema.resolvers.go`, let's implement our unimplemented function bodies: ```go func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) { From 5b2531aee84fa4f971ea83c083f7113b2d6b7c6e Mon Sep 17 00:00:00 2001 From: Aaron Arinder Date: Sun, 7 Feb 2021 14:43:34 -0500 Subject: [PATCH 10/50] getting started: wording update --- docs/content/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 821efe02669..7e002273352 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -103,7 +103,7 @@ func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) { We just need to implement these two methods to get our server working: -First we need somewhere to track our state, lets put it in `graph/resolver.go`. `graph/resolver.go` is where we declare any dependencies for our app, like our database. It gets initialized once in `server.go` when we create the graph. +First we need somewhere to track our state, lets put it in `graph/resolver.go`. The `graph/resolver.go` file is where we declare our app's dependencies, like our database. It gets initialized once in `server.go` when we create the graph. ```go type Resolver struct{ @@ -111,7 +111,7 @@ type Resolver struct{ } ``` -Returning to `graph/schema.resolvers.go`, let's implement our unimplemented function bodies: +Returning to `graph/schema.resolvers.go`, let's implement the bodies of our automatically generated resolver functions: ```go func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) { From aa531ed87f327f0e03d243744a5f5e810d5c1230 Mon Sep 17 00:00:00 2001 From: Aaron Arinder Date: Sun, 7 Feb 2021 14:44:19 -0500 Subject: [PATCH 11/50] getting started: more wording updates --- docs/content/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 7e002273352..caa63c10890 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -111,7 +111,7 @@ type Resolver struct{ } ``` -Returning to `graph/schema.resolvers.go`, let's implement the bodies of our automatically generated resolver functions: +Returning to `graph/schema.resolvers.go`, let's implement the bodies of those automatically generated resolver functions: ```go func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) { From 31d339ab390a2c4119fec42c54edabebd96ef730 Mon Sep 17 00:00:00 2001 From: Aaron Arinder Date: Sun, 7 Feb 2021 14:53:54 -0500 Subject: [PATCH 12/50] getting started: make running server own section --- docs/content/getting-started.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 99a3be37270..b7afd9e4831 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -128,12 +128,14 @@ func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) { } ``` +### Run the server + We now have a working server, to start it: ```bash go run server.go ``` -then open http://localhost:8080 in a browser. here are some queries to try: +Open http://localhost:8080 in a browser. Here are some queries to try: ```graphql mutation createTodo { createTodo(input:{text:"todo", userId:"1"}) { From 67e652ad974418a9f6fa9cfa4c97eebc3db910bf Mon Sep 17 00:00:00 2001 From: Aaron Arinder Date: Sun, 7 Feb 2021 14:57:18 -0500 Subject: [PATCH 13/50] getting started: separate example mutation/query --- docs/content/getting-started.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index b7afd9e4831..083d1521b3f 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -135,7 +135,7 @@ We now have a working server, to start it: go run server.go ``` -Open http://localhost:8080 in a browser. Here are some queries to try: +Open http://localhost:8080 in a browser. Here are some queries to try, starting with creating a todo: ```graphql mutation createTodo { createTodo(input:{text:"todo", userId:"1"}) { @@ -146,7 +146,11 @@ mutation createTodo { done } } +``` + +And then querying for it: +```graphql query findTodos { todos { text From c4bf36c5bd94b64e8d13060a77a7b8ac8050b794 Mon Sep 17 00:00:00 2001 From: frederikhors <41120635+frederikhors@users.noreply.github.com> Date: Sat, 13 Feb 2021 12:00:32 +0100 Subject: [PATCH 14/50] Add coveralls badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e6ebdaac1d..f6d6346911f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# gqlgen [![Continuous Integration](https://github.com/99designs/gqlgen/workflows/Continuous%20Integration/badge.svg)](https://github.com/99designs/gqlgen/actions) [![Read the Docs](https://badgen.net/badge/docs/available/green)](http://gqlgen.com/) [![GoDoc](https://godoc.org/github.com/99designs/gqlgen?status.svg)](https://godoc.org/github.com/99designs/gqlgen) +# gqlgen [![Continuous Integration](https://github.com/99designs/gqlgen/workflows/Continuous%20Integration/badge.svg)](https://github.com/99designs/gqlgen/actions) [![Read the Docs](https://badgen.net/badge/docs/available/green)](http://gqlgen.com/) [![Coverage Status](https://coveralls.io/repos/github/99designs/gqlgen/badge.svg?branch=master)](https://coveralls.io/github/99designs/gqlgen?branch=master) [![GoDoc](https://godoc.org/github.com/99designs/gqlgen?status.svg)](https://godoc.org/github.com/99designs/gqlgen) ![gqlgen](https://user-images.githubusercontent.com/46195831/89802919-0bb8ef00-db2a-11ea-8ba4-88e7a58b2fd2.png) From 45903a6597846c5ae71d82f156fc3ee3b743ec75 Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Sat, 6 Mar 2021 11:13:46 +1100 Subject: [PATCH 15/50] Handle nillable list elements --- codegen/type.gotpl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/codegen/type.gotpl b/codegen/type.gotpl index bd5c8435113..f088bbd2489 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -90,11 +90,11 @@ ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() if !isLen1 { defer wg.Done() } @@ -107,9 +107,16 @@ } {{ else }} ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) - {{- end}} + {{- end }} } {{ if not $type.IsScalar }} wg.Wait() {{ end }} + {{ if $type.Elem.NonNull }} + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + {{ end }} return ret {{- else }} {{- if $type.IsNilable }} From 55b774ba48146540bdef95d8cc027998eca7fd13 Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Sat, 6 Mar 2021 11:20:31 +1100 Subject: [PATCH 16/50] Fix type ref --- codegen/type.gotpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/type.gotpl b/codegen/type.gotpl index f088bbd2489..85a7cf6a5f2 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -110,7 +110,7 @@ {{- end }} } {{ if not $type.IsScalar }} wg.Wait() {{ end }} - {{ if $type.Elem.NonNull }} + {{ if $type.Elem.GQL.NonNull }} for _, e := range ret { if e == graphql.Null { return graphql.Null From 0b5da15cd87f315af0bc851a50f21362e4312002 Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Sat, 6 Mar 2021 12:10:13 +1100 Subject: [PATCH 17/50] Check in generated code --- codegen/testserver/generated.go | 106 +++++++++++++++++ example/chat/generated.go | 63 ++++++++++ example/config/generated.go | 69 +++++++++++ example/dataloader/generated.go | 84 +++++++++++++ .../accounts/graph/generated/generated.go | 63 ++++++++++ .../products/graph/generated/generated.go | 64 ++++++++++ .../reviews/graph/generated/generated.go | 64 ++++++++++ example/fileupload/generated.go | 69 +++++++++++ example/scalars/generated.go | 63 ++++++++++ example/selection/generated.go | 69 +++++++++++ example/starwars/generated/exec.go | 110 ++++++++++++++++++ example/todo/generated.go | 63 ++++++++++ example/type-system-extension/generated.go | 63 ++++++++++ integration/generated.go | 69 +++++++++++ 14 files changed, 1019 insertions(+) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index ea3c2f48547..2aac317f20b 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -13389,6 +13389,12 @@ func (ec *executionContext) marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋg ret[i] = ec.marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13445,6 +13451,13 @@ func (ec *executionContext) marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13486,6 +13499,13 @@ func (ec *executionContext) marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designs } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13551,6 +13571,12 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13673,6 +13699,13 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13774,6 +13807,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13847,6 +13887,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13896,6 +13943,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -13937,6 +13991,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14054,6 +14115,7 @@ func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designs } wg.Wait() + return ret } @@ -14094,6 +14156,13 @@ func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designs } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14359,6 +14428,7 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99design } wg.Wait() + return ret } @@ -14399,6 +14469,7 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚖgithubᚗcomᚋ99designs } wg.Wait() + return ret } @@ -14499,6 +14570,7 @@ func (ec *executionContext) marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + return ret } @@ -14551,6 +14623,12 @@ func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14710,6 +14788,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14750,6 +14835,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14790,6 +14882,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -14837,6 +14936,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/chat/generated.go b/example/chat/generated.go index 842b3e31ff9..9d162affae0 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -2447,6 +2447,13 @@ func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2528,6 +2535,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2601,6 +2615,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2650,6 +2671,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2691,6 +2719,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2811,6 +2846,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2851,6 +2893,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2891,6 +2940,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2938,6 +2994,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/config/generated.go b/example/config/generated.go index 4e985ada6b1..00a1145a3ea 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -2354,6 +2354,13 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2415,6 +2422,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2488,6 +2502,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2537,6 +2558,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2578,6 +2606,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2672,6 +2707,12 @@ func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2727,6 +2768,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2767,6 +2815,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2807,6 +2862,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2854,6 +2916,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index ef964a60ae8..342ac7cc389 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -2695,6 +2695,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2768,6 +2775,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2817,6 +2831,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2858,6 +2879,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2954,6 +2982,7 @@ func (ec *executionContext) marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designs } wg.Wait() + return ret } @@ -2994,6 +3023,13 @@ func (ec *executionContext) marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3030,6 +3066,12 @@ func (ec *executionContext) marshalOInt2ᚕintᚄ(ctx context.Context, sel ast.S ret[i] = ec.marshalNInt2int(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3106,6 +3148,13 @@ func (ec *executionContext) marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3146,6 +3195,13 @@ func (ec *executionContext) marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlge } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3210,6 +3266,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3250,6 +3313,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3290,6 +3360,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3337,6 +3414,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/federation/accounts/graph/generated/generated.go b/example/federation/accounts/graph/generated/generated.go index ddc536f26b8..1d64bbeda50 100644 --- a/example/federation/accounts/graph/generated/generated.go +++ b/example/federation/accounts/graph/generated/generated.go @@ -2276,6 +2276,12 @@ func (ec *executionContext) marshalN_Any2ᚕmapᚄ(ctx context.Context, sel ast. ret[i] = ec.marshalN_Any2map(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2313,6 +2319,7 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + return ret } @@ -2373,6 +2380,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2446,6 +2460,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2495,6 +2516,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2536,6 +2564,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2663,6 +2698,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2703,6 +2745,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2743,6 +2792,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2790,6 +2846,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/federation/products/graph/generated/generated.go b/example/federation/products/graph/generated/generated.go index 7a62335fdad..92c126f7aa3 100644 --- a/example/federation/products/graph/generated/generated.go +++ b/example/federation/products/graph/generated/generated.go @@ -2352,6 +2352,12 @@ func (ec *executionContext) marshalN_Any2ᚕmapᚄ(ctx context.Context, sel ast. ret[i] = ec.marshalN_Any2map(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2389,6 +2395,7 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + return ret } @@ -2449,6 +2456,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2522,6 +2536,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2571,6 +2592,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2612,6 +2640,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2716,6 +2751,7 @@ func (ec *executionContext) marshalOProduct2ᚕᚖgithubᚗcomᚋ99designsᚋgql } wg.Wait() + return ret } @@ -2794,6 +2830,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2834,6 +2877,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2874,6 +2924,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2921,6 +2978,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/federation/reviews/graph/generated/generated.go b/example/federation/reviews/graph/generated/generated.go index 8173a30dd32..192d961498f 100644 --- a/example/federation/reviews/graph/generated/generated.go +++ b/example/federation/reviews/graph/generated/generated.go @@ -2639,6 +2639,12 @@ func (ec *executionContext) marshalN_Any2ᚕmapᚄ(ctx context.Context, sel ast. ret[i] = ec.marshalN_Any2map(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2676,6 +2682,7 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + return ret } @@ -2736,6 +2743,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2809,6 +2823,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2858,6 +2879,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2899,6 +2927,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2988,6 +3023,7 @@ func (ec *executionContext) marshalOReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg } wg.Wait() + return ret } @@ -3066,6 +3102,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3106,6 +3149,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3146,6 +3196,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3193,6 +3250,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 9610785421c..bb3f308cfc1 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -2352,6 +2352,13 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2437,6 +2444,12 @@ func (ec *executionContext) marshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg ret[i] = ec.marshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2530,6 +2543,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2603,6 +2623,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2652,6 +2679,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2693,6 +2727,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2806,6 +2847,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2846,6 +2894,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2886,6 +2941,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2933,6 +2995,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/scalars/generated.go b/example/scalars/generated.go index aa21a4bd1cd..0773ab3b4dd 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -2754,6 +2754,13 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2805,6 +2812,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2878,6 +2892,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2927,6 +2948,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2968,6 +2996,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3184,6 +3219,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3224,6 +3266,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3264,6 +3313,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3311,6 +3367,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/selection/generated.go b/example/selection/generated.go index 053bf1dbf70..ddbd977d5d2 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -2218,6 +2218,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2291,6 +2298,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2340,6 +2354,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2381,6 +2402,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2470,6 +2498,13 @@ func (ec *executionContext) marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2515,6 +2550,12 @@ func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2570,6 +2611,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2610,6 +2658,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2650,6 +2705,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2697,6 +2759,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 3964d7f1069..d82d169b60b 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -4401,6 +4401,13 @@ func (ec *executionContext) marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4500,6 +4507,12 @@ func (ec *executionContext) marshalNInt2ᚕintᚄ(ctx context.Context, sel ast.S ret[i] = ec.marshalNInt2int(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4530,6 +4543,12 @@ func (ec *executionContext) marshalNInt2ᚕᚕintᚄ(ctx context.Context, sel as ret[i] = ec.marshalNInt2ᚕintᚄ(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4571,6 +4590,13 @@ func (ec *executionContext) marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4633,6 +4659,13 @@ func (ec *executionContext) marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4699,6 +4732,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4772,6 +4812,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4821,6 +4868,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4862,6 +4916,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -4958,6 +5019,13 @@ func (ec *executionContext) marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5030,6 +5098,13 @@ func (ec *executionContext) marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designs } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5140,6 +5215,13 @@ func (ec *executionContext) marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5235,6 +5317,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5275,6 +5364,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5315,6 +5411,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -5362,6 +5465,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/todo/generated.go b/example/todo/generated.go index cb73c7c6c47..2e5ceeb2300 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -2385,6 +2385,13 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2441,6 +2448,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2514,6 +2528,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2563,6 +2584,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2604,6 +2632,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2724,6 +2759,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2764,6 +2806,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2804,6 +2853,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2851,6 +2907,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 2a8cc69338c..eb50a955fc6 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -2398,6 +2398,13 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2454,6 +2461,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2527,6 +2541,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2576,6 +2597,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2617,6 +2645,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2737,6 +2772,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2777,6 +2819,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2817,6 +2866,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2864,6 +2920,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } diff --git a/integration/generated.go b/integration/generated.go index 160d95ced50..94a65076232 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -2632,6 +2632,12 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2673,6 +2679,13 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2746,6 +2759,13 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2795,6 +2815,13 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2836,6 +2863,13 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2906,6 +2940,12 @@ func (ec *executionContext) marshalOBoolean2ᚕboolᚄ(ctx context.Context, sel ret[i] = ec.marshalNBoolean2bool(ctx, sel, v[i]) } + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -2977,6 +3017,7 @@ func (ec *executionContext) marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgql } wg.Wait() + return ret } @@ -3093,6 +3134,13 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3133,6 +3181,13 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3173,6 +3228,13 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } @@ -3220,6 +3282,13 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + return ret } From 635b1aef316c528b6f17416057d41a0948b42a2d Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Sat, 6 Mar 2021 12:51:20 +1100 Subject: [PATCH 18/50] Add Test Case --- codegen/testserver/generated.go | 105 ++++++++++++++++++++++++++++-- codegen/testserver/nulls.graphql | 1 + codegen/testserver/nulls_test.go | 16 ++++- codegen/testserver/resolver.go | 4 ++ codegen/testserver/slices.graphql | 8 +-- codegen/testserver/stub.go | 4 ++ 6 files changed, 129 insertions(+), 9 deletions(-) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 2aac317f20b..21876449d4f 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -278,6 +278,7 @@ type ComplexityRoot struct { EmbeddedCase3 func(childComplexity int) int EnumInInput func(childComplexity int, input *InputWithEnumValue) int ErrorBubble func(childComplexity int) int + ErrorBubbleList func(childComplexity int) int Errors func(childComplexity int) int Fallback func(childComplexity int, arg FallbackToStringEncoding) int InputNullableSlice func(childComplexity int, arg []string) int @@ -457,6 +458,7 @@ type QueryResolver interface { MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) MapNestedStringInterface(ctx context.Context, in *NestedMapInput) (map[string]interface{}, error) ErrorBubble(ctx context.Context) (*Error, error) + ErrorBubbleList(ctx context.Context) ([]*Error, error) Errors(ctx context.Context) (*Errors, error) Valid(ctx context.Context) (string, error) Panics(ctx context.Context) (*Panics, error) @@ -1199,6 +1201,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.ErrorBubble(childComplexity), true + case "Query.errorBubbleList": + if e.complexity.Query.ErrorBubbleList == nil { + break + } + + return e.complexity.Query.ErrorBubbleList(childComplexity), true + case "Query.errors": if e.complexity.Query.Errors == nil { break @@ -2039,6 +2048,7 @@ input NestedInput { `, BuiltIn: false}, {Name: "nulls.graphql", Input: `extend type Query { errorBubble: Error + errorBubbleList: [Error!] errors: Errors valid: String! } @@ -2204,10 +2214,10 @@ scalar Time } type Slices { - test1: [String] - test2: [String!] - test3: [String]! - test4: [String!]! + test1: [String] + test2: [String!] + test3: [String]! + test4: [String!]! } scalar Bytes @@ -7212,6 +7222,35 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq return ec.marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } +func (ec *executionContext) _Query_errorBubbleList(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ErrorBubbleList(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrorᚄ(ctx, field.Selections, res) +} + func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -12266,6 +12305,17 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr res = ec._Query_errorBubble(ctx, field) return res }) + case "errorBubbleList": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_errorBubbleList(ctx, field) + return res + }) case "errors": field := field out.Concurrently(i, func() (res graphql.Marshaler) { @@ -14216,6 +14266,53 @@ func (ec *executionContext) marshalOEmbeddedCase32ᚖgithubᚗcomᚋ99designsᚋ return ec._EmbeddedCase3(ctx, sel, v) } +func (ec *executionContext) marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrorᚄ(ctx context.Context, sel ast.SelectionSet, v []*Error) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx context.Context, sel ast.SelectionSet, v *Error) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/codegen/testserver/nulls.graphql b/codegen/testserver/nulls.graphql index d93f6b0cf62..0f1af3dd30d 100644 --- a/codegen/testserver/nulls.graphql +++ b/codegen/testserver/nulls.graphql @@ -1,5 +1,6 @@ extend type Query { errorBubble: Error + errorBubbleList: [Error!] errors: Errors valid: String! } diff --git a/codegen/testserver/nulls_test.go b/codegen/testserver/nulls_test.go index e79eecc283a..5bf2112ae6d 100644 --- a/codegen/testserver/nulls_test.go +++ b/codegen/testserver/nulls_test.go @@ -14,13 +14,15 @@ func TestNullBubbling(t *testing.T) { resolvers.QueryResolver.Valid = func(ctx context.Context) (s string, e error) { return "Ok", nil } - resolvers.QueryResolver.Errors = func(ctx context.Context) (errors *Errors, e error) { return &Errors{}, nil } resolvers.QueryResolver.ErrorBubble = func(ctx context.Context) (i *Error, e error) { return &Error{ID: "E1234"}, nil } + resolvers.QueryResolver.ErrorBubbleList = func(ctx context.Context) (i []*Error, e error) { + return []*Error{nil}, nil + } c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) @@ -68,6 +70,18 @@ func TestNullBubbling(t *testing.T) { require.Equal(t, "Ok", resp.Valid) }) + t.Run("when non-null list element is null", func(t *testing.T) { + var resp struct { + Valid string + ErrorBubbleList []*struct{} + } + err := c.Post(`query { valid, errorBubbleList { id } }`, &resp) + + require.EqualError(t, err, `[{"message":"must not be null","path":["errorBubbleList", 0]}]`) + require.Nil(t, resp.ErrorBubbleList) + require.Equal(t, "Ok", resp.Valid) + }) + t.Run("null args", func(t *testing.T) { var resp struct { NullableArg *string diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index 952d20943e8..edc4001f51b 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -232,6 +232,10 @@ func (r *queryResolver) ErrorBubble(ctx context.Context) (*Error, error) { panic("not implemented") } +func (r *queryResolver) ErrorBubbleList(ctx context.Context) ([]*Error, error) { + panic("not implemented") +} + func (r *queryResolver) Errors(ctx context.Context) (*Errors, error) { panic("not implemented") } diff --git a/codegen/testserver/slices.graphql b/codegen/testserver/slices.graphql index 671235d0b37..b1265c56c0b 100644 --- a/codegen/testserver/slices.graphql +++ b/codegen/testserver/slices.graphql @@ -4,10 +4,10 @@ extend type Query { } type Slices { - test1: [String] - test2: [String!] - test3: [String]! - test4: [String!]! + test1: [String] + test2: [String!] + test3: [String]! + test4: [String!]! } scalar Bytes diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index daf4052ea08..5ca93fd8046 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -85,6 +85,7 @@ type Stub struct { MapStringInterface func(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) MapNestedStringInterface func(ctx context.Context, in *NestedMapInput) (map[string]interface{}, error) ErrorBubble func(ctx context.Context) (*Error, error) + ErrorBubbleList func(ctx context.Context) ([]*Error, error) Errors func(ctx context.Context) (*Errors, error) Valid func(ctx context.Context) (string, error) Panics func(ctx context.Context) (*Panics, error) @@ -358,6 +359,9 @@ func (r *stubQuery) MapNestedStringInterface(ctx context.Context, in *NestedMapI func (r *stubQuery) ErrorBubble(ctx context.Context) (*Error, error) { return r.QueryResolver.ErrorBubble(ctx) } +func (r *stubQuery) ErrorBubbleList(ctx context.Context) ([]*Error, error) { + return r.QueryResolver.ErrorBubbleList(ctx) +} func (r *stubQuery) Errors(ctx context.Context) (*Errors, error) { return r.QueryResolver.Errors(ctx) } From 469e31bddf27395e5d124694e683cecc44fa00d3 Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Sat, 6 Mar 2021 13:00:03 +1100 Subject: [PATCH 19/50] Fix bad test case --- codegen/testserver/nulls_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/testserver/nulls_test.go b/codegen/testserver/nulls_test.go index 5bf2112ae6d..00fccb519c4 100644 --- a/codegen/testserver/nulls_test.go +++ b/codegen/testserver/nulls_test.go @@ -77,7 +77,7 @@ func TestNullBubbling(t *testing.T) { } err := c.Post(`query { valid, errorBubbleList { id } }`, &resp) - require.EqualError(t, err, `[{"message":"must not be null","path":["errorBubbleList", 0]}]`) + require.EqualError(t, err, `[{"message":"must not be null","path":["errorBubbleList",0]}]`) require.Nil(t, resp.ErrorBubbleList) require.Equal(t, "Ok", resp.Valid) }) From 1fac78e9b4d68a76d3ae2fc0b980e7569cc3eb3c Mon Sep 17 00:00:00 2001 From: Wilhelm Date: Mon, 8 Mar 2021 10:38:46 +1100 Subject: [PATCH 20/50] Add test case for nullable field --- codegen/testserver/generated.go | 91 ++++++++++++++++++++++++++++++++ codegen/testserver/nulls.graphql | 1 + codegen/testserver/nulls_test.go | 18 ++++++- codegen/testserver/resolver.go | 4 ++ codegen/testserver/stub.go | 4 ++ 5 files changed, 117 insertions(+), 1 deletion(-) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 21876449d4f..b14d6110e55 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -279,6 +279,7 @@ type ComplexityRoot struct { EnumInInput func(childComplexity int, input *InputWithEnumValue) int ErrorBubble func(childComplexity int) int ErrorBubbleList func(childComplexity int) int + ErrorList func(childComplexity int) int Errors func(childComplexity int) int Fallback func(childComplexity int, arg FallbackToStringEncoding) int InputNullableSlice func(childComplexity int, arg []string) int @@ -459,6 +460,7 @@ type QueryResolver interface { MapNestedStringInterface(ctx context.Context, in *NestedMapInput) (map[string]interface{}, error) ErrorBubble(ctx context.Context) (*Error, error) ErrorBubbleList(ctx context.Context) ([]*Error, error) + ErrorList(ctx context.Context) ([]*Error, error) Errors(ctx context.Context) (*Errors, error) Valid(ctx context.Context) (string, error) Panics(ctx context.Context) (*Panics, error) @@ -1208,6 +1210,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.ErrorBubbleList(childComplexity), true + case "Query.errorList": + if e.complexity.Query.ErrorList == nil { + break + } + + return e.complexity.Query.ErrorList(childComplexity), true + case "Query.errors": if e.complexity.Query.Errors == nil { break @@ -2049,6 +2058,7 @@ input NestedInput { {Name: "nulls.graphql", Input: `extend type Query { errorBubble: Error errorBubbleList: [Error!] + errorList: [Error] errors: Errors valid: String! } @@ -7251,6 +7261,35 @@ func (ec *executionContext) _Query_errorBubbleList(ctx context.Context, field gr return ec.marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrorᚄ(ctx, field.Selections, res) } +func (ec *executionContext) _Query_errorList(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ErrorList(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Error) + fc.Result = res + return ec.marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) +} + func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -12316,6 +12355,17 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr res = ec._Query_errorBubbleList(ctx, field) return res }) + case "errorList": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_errorList(ctx, field) + return res + }) case "errors": field := field out.Concurrently(i, func() (res graphql.Marshaler) { @@ -14266,6 +14316,47 @@ func (ec *executionContext) marshalOEmbeddedCase32ᚖgithubᚗcomᚋ99designsᚋ return ec._EmbeddedCase3(ctx, sel, v) } +func (ec *executionContext) marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx context.Context, sel ast.SelectionSet, v []*Error) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + func (ec *executionContext) marshalOError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrorᚄ(ctx context.Context, sel ast.SelectionSet, v []*Error) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/codegen/testserver/nulls.graphql b/codegen/testserver/nulls.graphql index 0f1af3dd30d..a1fea680ce2 100644 --- a/codegen/testserver/nulls.graphql +++ b/codegen/testserver/nulls.graphql @@ -1,6 +1,7 @@ extend type Query { errorBubble: Error errorBubbleList: [Error!] + errorList: [Error] errors: Errors valid: String! } diff --git a/codegen/testserver/nulls_test.go b/codegen/testserver/nulls_test.go index 00fccb519c4..4822829d174 100644 --- a/codegen/testserver/nulls_test.go +++ b/codegen/testserver/nulls_test.go @@ -23,6 +23,9 @@ func TestNullBubbling(t *testing.T) { resolvers.QueryResolver.ErrorBubbleList = func(ctx context.Context) (i []*Error, e error) { return []*Error{nil}, nil } + resolvers.QueryResolver.ErrorList = func(ctx context.Context) (i []*Error, e error) { + return []*Error{nil}, nil + } c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) @@ -70,6 +73,19 @@ func TestNullBubbling(t *testing.T) { require.Equal(t, "Ok", resp.Valid) }) + t.Run("when list element is null", func(t *testing.T) { + var resp struct { + Valid string + ErrorList []*struct{} + } + err := c.Post(`query { valid, errorList { id } }`, &resp) + + require.Nil(t, err) + require.Equal(t, len(resp.ErrorList), 1) + require.Nil(t, resp.ErrorList[0]) + require.Equal(t, "Ok", resp.Valid) + }) + t.Run("when non-null list element is null", func(t *testing.T) { var resp struct { Valid string @@ -104,7 +120,7 @@ func TestNullBubbling(t *testing.T) { resolvers.ErrorsResolver.D = func(ctx context.Context, obj *Errors) (i *Error, e error) { return nil, nil } resolvers.ErrorsResolver.E = func(ctx context.Context, obj *Errors) (i *Error, e error) { return nil, nil } - err := c.Post(`{ errors { + err := c.Post(`{ errors { a { id }, b { id }, c { id }, diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index edc4001f51b..7b197d0c9cf 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -236,6 +236,10 @@ func (r *queryResolver) ErrorBubbleList(ctx context.Context) ([]*Error, error) { panic("not implemented") } +func (r *queryResolver) ErrorList(ctx context.Context) ([]*Error, error) { + panic("not implemented") +} + func (r *queryResolver) Errors(ctx context.Context) (*Errors, error) { panic("not implemented") } diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index 5ca93fd8046..4b584fbbbf6 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -86,6 +86,7 @@ type Stub struct { MapNestedStringInterface func(ctx context.Context, in *NestedMapInput) (map[string]interface{}, error) ErrorBubble func(ctx context.Context) (*Error, error) ErrorBubbleList func(ctx context.Context) ([]*Error, error) + ErrorList func(ctx context.Context) ([]*Error, error) Errors func(ctx context.Context) (*Errors, error) Valid func(ctx context.Context) (string, error) Panics func(ctx context.Context) (*Panics, error) @@ -362,6 +363,9 @@ func (r *stubQuery) ErrorBubble(ctx context.Context) (*Error, error) { func (r *stubQuery) ErrorBubbleList(ctx context.Context) ([]*Error, error) { return r.QueryResolver.ErrorBubbleList(ctx) } +func (r *stubQuery) ErrorList(ctx context.Context) ([]*Error, error) { + return r.QueryResolver.ErrorList(ctx) +} func (r *stubQuery) Errors(ctx context.Context) (*Errors, error) { return r.QueryResolver.Errors(ctx) } From 82a8e1bf39aec5225e05deb8e026083d859d50ef Mon Sep 17 00:00:00 2001 From: Michael Compton Date: Mon, 15 Mar 2021 15:04:14 +1100 Subject: [PATCH 21/50] Make it clearer what happened on init. (#1487) --- docs/content/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 92f99ded949..76f5bd39c42 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -85,8 +85,8 @@ type Mutation { ### Implement the resolvers -`gqlgen generate` compares the schema file (`graph/schema.graphqls`) with the models `graph/model/*` and wherever it -can it will bind directly to the model. +When executed, gqlgen's `generate` command compares the schema file (`graph/schema.graphqls`) with the models `graph/model/*`, and, wherever it +can, it will bind directly to the model. That was done alread when `init` was run. We'll edit the schema later in the tutorial, but for now, let's look at what was generated already. If we take a look in `graph/schema.resolvers.go` we will see all the times that gqlgen couldn't match them up. For us it was twice: From b995f7f1fa2e18b4016d167739213ec5de95a053 Mon Sep 17 00:00:00 2001 From: Michael Compton Date: Mon, 15 Mar 2021 17:09:56 +1100 Subject: [PATCH 22/50] Make spacing consistent (#1488) --- docs/content/reference/complexity.md | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/content/reference/complexity.md b/docs/content/reference/complexity.md index 81367c1cccd..e99ac130587 100644 --- a/docs/content/reference/complexity.md +++ b/docs/content/reference/complexity.md @@ -13,13 +13,13 @@ Consider a schema that allows listing blog posts. Each blog post is also related ```graphql type Query { - posts(count: Int = 10): [Post!]! + posts(count: Int = 10): [Post!]! } type Post { - title: String! - text: String! - related(count: Int = 10): [Post!]! + title: String! + text: String! + related(count: Int = 10): [Post!]! } ``` @@ -27,15 +27,15 @@ It's not too hard to craft a query that will cause a very large response: ```graphql { - posts(count: 100) { - related(count: 100) { - related(count: 100) { - related(count: 100) { - title - } - } - } - } + posts(count: 100) { + related(count: 100) { + related(count: 100) { + related(count: 100) { + title + } + } + } + } } ``` @@ -47,12 +47,12 @@ Limiting query complexity is as simple as specifying it with the provided extens ```go func main() { - c := Config{ Resolvers: &resolvers{} } + c := Config{ Resolvers: &resolvers{} } srv := handler.NewDefaultServer(blog.NewExecutableSchema(c)) srv.Use(extension.FixedComplexityLimit(5)) // This line is key - r.Handle("/query", srv) + r.Handle("/query", srv) } ``` @@ -66,17 +66,17 @@ To apply higher costs to certain fields, we can use custom complexity functions. ```go func main() { - c := Config{ Resolvers: &resolvers{} } + c := Config{ Resolvers: &resolvers{} } - countComplexity := func(childComplexity, count int) int { - return count * childComplexity - } - c.Complexity.Query.Posts = countComplexity - c.Complexity.Post.Related = countComplexity + countComplexity := func(childComplexity, count int) int { + return count * childComplexity + } + c.Complexity.Query.Posts = countComplexity + c.Complexity.Post.Related = countComplexity - srv := handler.NewDefaultServer(blog.NewExecutableSchema(c)) + srv := handler.NewDefaultServer(blog.NewExecutableSchema(c)) srv.Use(extension.FixedComplexityLimit(5)) - http.Handle("/query", gqlHandler) + http.Handle("/query", gqlHandler) } ``` From 7985db44855b160c1f2552bedbfed5bc150fc840 Mon Sep 17 00:00:00 2001 From: Michael Compton Date: Tue, 16 Mar 2021 09:38:18 +1100 Subject: [PATCH 23/50] Mention math.rand for the todo ID (#1489) --- docs/content/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index 80122ba7632..5192de632cf 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -111,7 +111,7 @@ type Resolver struct{ } ``` -Returning to `graph/schema.resolvers.go`, let's implement the bodies of those automatically generated resolver functions: +Returning to `graph/schema.resolvers.go`, let's implement the bodies of those automatically generated resolver functions. For `CreateTodo`, we'll use `math.rand` to simply return a todo with a randomly generated ID and store that in the in-memory todos list --- in a real app, you're likely to use a database or some other backend service. ```go func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) { From 54e387c45e97e7b7922f06baf1c6e57dd5a7ff2e Mon Sep 17 00:00:00 2001 From: KzKarino Date: Sat, 20 Mar 2021 21:20:12 +0900 Subject: [PATCH 24/50] Resolve indirect dependency vulnerability in example --- go.mod | 6 +++--- go.sum | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cb8e7ce0137..ad97c98e735 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/agnivade/levenshtein v1.0.3 // indirect - github.com/gogo/protobuf v1.0.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect github.com/gorilla/mux v1.6.1 // indirect github.com/gorilla/websocket v1.4.2 @@ -24,8 +24,8 @@ require ( github.com/urfave/cli/v2 v2.1.1 github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e github.com/vektah/gqlparser/v2 v2.1.0 - golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 + golang.org/x/tools v0.0.0-20210106214847-113979e3529a gopkg.in/yaml.v2 v2.2.4 - sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755 + sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect ) diff --git a/go.sum b/go.sum index 707488e6c26..345d4c68387 100644 --- a/go.sum +++ b/go.sum @@ -15,6 +15,8 @@ github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c h1:TUuUh0Xgj97tLMN github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/gogo/protobuf v1.0.0 h1:2jyBKDKU/8v3v2xVR2PtiWQviFUyiaGk2rpfyFT8rTM= github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.1 h1:KOwqsTYZdeuMacU7CxjMNYEKeBvLbxW+psodrbcEa3A= @@ -23,6 +25,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -69,25 +73,44 @@ github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWp github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= github.com/vektah/gqlparser/v2 v2.1.0 h1:uiKJ+T5HMGGQM2kRKQ8Pxw8+Zq9qhhZhz/lieYvCMns= github.com/vektah/gqlparser/v2 v2.1.0/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4XkV2se04Px1Ms= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM= golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -96,5 +119,7 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755 h1:d2maSb13hr/ArmfK3rW+wNUKKfytCol7W1/vDHxMPiE= sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI= sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k= From 03b57f3e01f34504261550aacb0b08f64843b6ad Mon Sep 17 00:00:00 2001 From: KzKarino Date: Sat, 20 Mar 2021 22:22:16 +0900 Subject: [PATCH 25/50] Run go mod tidy --- go.mod | 2 +- go.sum | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index ad97c98e735..f77773be11e 100644 --- a/go.mod +++ b/go.mod @@ -26,6 +26,6 @@ require ( github.com/vektah/gqlparser/v2 v2.1.0 golang.org/x/tools v0.0.0-20210106214847-113979e3529a gopkg.in/yaml.v2 v2.2.4 - sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect + sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect ) diff --git a/go.sum b/go.sum index 345d4c68387..6dbb9486152 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c h1:TUuUh0Xgj97tLMNtWtNvI9mIV6isjEb9lBMNv+77IGM= github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= -github.com/gogo/protobuf v1.0.0 h1:2jyBKDKU/8v3v2xVR2PtiWQviFUyiaGk2rpfyFT8rTM= -github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk= @@ -78,8 +76,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -96,6 +94,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -103,13 +102,13 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM= -golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= @@ -117,8 +116,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755 h1:d2maSb13hr/ArmfK3rW+wNUKKfytCol7W1/vDHxMPiE= -sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI= From 8c3e64e1965081ff07bbe9353dd9246817232887 Mon Sep 17 00:00:00 2001 From: Joe Zhou Date: Sun, 21 Mar 2021 01:26:48 -0400 Subject: [PATCH 26/50] Improve APQ documentation --- docs/content/reference/apq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/reference/apq.md b/docs/content/reference/apq.md index 32df5effc04..2be30fa2429 100644 --- a/docs/content/reference/apq.md +++ b/docs/content/reference/apq.md @@ -16,8 +16,8 @@ to register query hash with original query on a server. In order to enable Automatic Persisted Queries you need to change your client. For more information see [Automatic Persisted Queries Link](https://github.com/apollographql/apollo-link-persisted-queries) documentation. -For the server you need to implement `PersistedQueryCache` interface and pass instance to -`handler.EnablePersistedQueryCache` option. +For the server you need to implement the `graphql.Cache` interface and pass an instance to +the `extension.AutomaticPersistedQuery` type. Make sure the extension is applied to your GraphQL handler. See example using [go-redis](https://github.com/go-redis/redis) package below: ```go From e02db808a857ce1ec31861b3b0b54fa4d5cb85e6 Mon Sep 17 00:00:00 2001 From: Luke Cawood Date: Tue, 30 Mar 2021 13:00:26 +1100 Subject: [PATCH 27/50] Run go mod tidy after code generation --- .github/workflows/check-init | 12 ++++++++++++ .github/workflows/integration.yml | 8 ++++++++ api/generate.go | 3 +++ example/init/go.mod | 5 +++++ internal/code/packages.go | 10 ++++++++++ 5 files changed, 38 insertions(+) create mode 100755 .github/workflows/check-init create mode 100644 example/init/go.mod diff --git a/.github/workflows/check-init b/.github/workflows/check-init new file mode 100755 index 00000000000..9c09e84f407 --- /dev/null +++ b/.github/workflows/check-init @@ -0,0 +1,12 @@ +#!/bin/bash + +set -euo pipefail + +cd example/init + +go get github.com/99designs/gqlgen + +if { go run github.com/99designs/gqlgen init 2>&1 >&3 3>&- | grep '^' >&2; } 3>&1; then + echo "gqlgen init failed validation" + exit 125 +fi diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 273e4f5f4e8..8000b49bd50 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,3 +22,11 @@ jobs: - run: go mod download - run: cd example/federation ; npm install - run: .github/workflows/check-federation + + init: + runs-on: ubuntu-latest + container: golang:1.16-alpine + steps: + - uses: actions/checkout@v1 + - run: apk add --no-cache --no-progress alpine-sdk bash + - run: .github/workflows/check-init diff --git a/api/generate.go b/api/generate.go index 3a19c017de9..d9484005173 100644 --- a/api/generate.go +++ b/api/generate.go @@ -77,6 +77,9 @@ func Generate(cfg *config.Config, option ...Option) error { if err = codegen.GenerateCode(data); err != nil { return errors.Wrap(err, "generating core failed") } + if err = cfg.Packages.ModTidy(); err != nil { + return errors.Wrap(err, "tidy failed") + } for _, p := range plugins { if mut, ok := p.(plugin.CodeGenerator); ok { diff --git a/example/init/go.mod b/example/init/go.mod new file mode 100644 index 00000000000..40eb45b4f85 --- /dev/null +++ b/example/init/go.mod @@ -0,0 +1,5 @@ +module gqlgen.com/inittest + +go 1.16 + +replace github.com/99designs/gqlgen => ../.. diff --git a/internal/code/packages.go b/internal/code/packages.go index b14c45ad276..d3a4058530b 100644 --- a/internal/code/packages.go +++ b/internal/code/packages.go @@ -2,6 +2,7 @@ package code import ( "bytes" + "os/exec" "path/filepath" "github.com/pkg/errors" @@ -149,6 +150,15 @@ func (p *Packages) Evict(importPath string) { } } +func (p *Packages) ModTidy() error { + p.packages = nil + tidyCmd := exec.Command("go", "mod", "tidy") + if err := tidyCmd.Run(); err != nil { + return errors.Wrap(err, "go mod tidy failed") + } + return nil +} + // Errors returns any errors that were returned by Load, either from the call itself or any of the loaded packages. func (p *Packages) Errors() PkgErrors { var res []error //nolint:prealloc From 5f21f9d9ecdedca84810d7fda605c6eddd1f2335 Mon Sep 17 00:00:00 2001 From: Luke Cawood Date: Tue, 30 Mar 2021 17:28:38 +1100 Subject: [PATCH 28/50] Remove chi from dataloader example --- example/dataloader/server/server.go | 6 ++---- go.mod | 1 - go.sum | 10 ---------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/example/dataloader/server/server.go b/example/dataloader/server/server.go index d599330ff90..a11d46a0fe5 100644 --- a/example/dataloader/server/server.go +++ b/example/dataloader/server/server.go @@ -7,12 +7,10 @@ import ( "github.com/99designs/gqlgen/example/dataloader" "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/playground" - "github.com/go-chi/chi" ) func main() { - router := chi.NewRouter() - router.Use(dataloader.LoaderMiddleware) + router := http.NewServeMux() router.Handle("/", playground.Handler("Dataloader", "/query")) router.Handle("/query", handler.NewDefaultServer( @@ -20,5 +18,5 @@ func main() { )) log.Println("connect to http://localhost:8082/ for graphql playground") - log.Fatal(http.ListenAndServe(":8082", router)) + log.Fatal(http.ListenAndServe(":8082", dataloader.LoaderMiddleware(router))) } diff --git a/go.mod b/go.mod index 3130a194457..cb8e7ce0137 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.12 require ( github.com/agnivade/levenshtein v1.0.3 // indirect - github.com/go-chi/chi v1.5.1 github.com/gogo/protobuf v1.0.0 // indirect github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect github.com/gorilla/mux v1.6.1 // indirect diff --git a/go.sum b/go.sum index 8fcfa821c17..707488e6c26 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/agnivade/levenshtein v1.0.1 h1:3oJU7J3FGFmyhn8KHjmVaZCN5hxTr7GxgRue+sxIXdQ= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/agnivade/levenshtein v1.0.3 h1:M5ZnqLOoZR8ygVq0FfkXsNOKzMCk0xRiow0R5+5VkQ0= github.com/agnivade/levenshtein v1.0.3/go.mod h1:4SFRZbbXWLF4MU1T9Qg0pGgH3Pjs+t6ie5efyrwRJXs= @@ -9,14 +8,11 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c h1:TUuUh0Xgj97tLMNtWtNvI9mIV6isjEb9lBMNv+77IGM= github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= -github.com/go-chi/chi v1.5.1 h1:kfTK3Cxd/dkMu/rKs5ZceWYp+t5CtiE7vmaTv3LjC6w= -github.com/go-chi/chi v1.5.1/go.mod h1:REp24E+25iKvxgeTfHmdUoL5x15kBiDBlnIl5bCwe2k= github.com/gogo/protobuf v1.0.0 h1:2jyBKDKU/8v3v2xVR2PtiWQviFUyiaGk2rpfyFT8rTM= github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk= @@ -64,7 +60,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0 h1:JJV9CsgM9EC9w2iVkwuz+sMx8yRFe89PJRUrv6hPCIA= github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -77,7 +72,6 @@ github.com/vektah/gqlparser/v2 v2.1.0/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4Xk golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= @@ -89,18 +83,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6 h1:iZgcI2DDp6zW5v9Z/5+f0NuqoxNdmzg4hivjk2WLXpY= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd h1:oMEQDWVXVNpceQoVd1JN3CQ7LYJJzs5qWqZIUcxXHHw= golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM= golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 3cfc5b14d89ff8250656e40f967d1b0fae9de374 Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Sun, 11 Apr 2021 13:48:51 +0300 Subject: [PATCH 29/50] codegen/config: restore current working directory after changing it Before this commit, a call to config.LoadConfigFromDefaultLocations changed the working directory to the directory that contains the gqlgen config file. This commit changes the implementation to restore the working directory after loading the config. --- codegen/config/config.go | 24 +++++++++++++++--------- codegen/config/config_test.go | 5 +++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/codegen/config/config.go b/codegen/config/config.go index ba939fcf59a..24ea9e7ef04 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -70,8 +70,8 @@ func LoadDefaultConfig() (*Config, error) { // LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories // walking up the tree. The closest config file will be returned. -func LoadConfigFromDefaultLocations() (*Config, error) { - cfgFile, err := findCfg() +func LoadConfigFromDefaultLocations() (cfg *Config, err error) { + cfgFile, cwd, err := findCfg() if err != nil { return nil, err } @@ -80,6 +80,12 @@ func LoadConfigFromDefaultLocations() (*Config, error) { if err != nil { return nil, errors.Wrap(err, "unable to enter config dir") } + defer func() { + if cerr := os.Chdir(cwd); cerr != nil { + cfg = nil + err = errors.Wrap(cerr, "unable to restore working directory") + } + }() return LoadConfig(cfgFile) } @@ -467,24 +473,24 @@ func inStrSlice(haystack []string, needle string) bool { // findCfg searches for the config file in this directory and all parents up the tree // looking for the closest match -func findCfg() (string, error) { - dir, err := os.Getwd() +func findCfg() (string, string, error) { + cwd, err := os.Getwd() if err != nil { - return "", errors.Wrap(err, "unable to get working dir to findCfg") + return "", "", errors.Wrap(err, "unable to get working dir to findCfg") } - cfg := findCfgInDir(dir) + cfg := findCfgInDir(cwd) - for cfg == "" && dir != filepath.Dir(dir) { + for dir := cwd; cfg == "" && dir != filepath.Dir(dir); { dir = filepath.Dir(dir) cfg = findCfgInDir(dir) } if cfg == "" { - return "", os.ErrNotExist + return "", "", os.ErrNotExist } - return cfg, nil + return cfg, cwd, nil } func findCfgInDir(dir string) string { diff --git a/codegen/config/config_test.go b/codegen/config/config_test.go index b16e90c11a5..de63b15d3f0 100644 --- a/codegen/config/config_test.go +++ b/codegen/config/config_test.go @@ -72,9 +72,14 @@ func TestLoadConfigFromDefaultLocation(t *testing.T) { err = os.Chdir(filepath.Join(testDir, "testdata", "cfg", "otherdir")) require.NoError(t, err) + before, err := os.Getwd() + require.NoError(t, err) cfg, err = LoadConfigFromDefaultLocations() require.NoError(t, err) require.Equal(t, StringList{"outer"}, cfg.SchemaFilename) + after, err := os.Getwd() + require.NoError(t, err) + require.Equal(t, before, after) }) t.Run("will return error if config doesn't exist", func(t *testing.T) { From 3f68ea27a1a9fea2064caf877f7e24d00aa439e6 Mon Sep 17 00:00:00 2001 From: ananya saxena Date: Sun, 11 Apr 2021 21:16:10 -0700 Subject: [PATCH 30/50] Special handling for pointers to slices (#1363) --- TESTING.md | 4 +- codegen/config/binder.go | 8 ++ codegen/testserver/generated.go | 153 ++++++++++++++++++++++++ codegen/testserver/ptr_to_slice.go | 5 + codegen/testserver/ptr_to_slice.graphql | 7 ++ codegen/testserver/ptr_to_slice_test.go | 37 ++++++ codegen/testserver/resolver.go | 4 + codegen/testserver/stub.go | 4 + codegen/type.go | 2 +- codegen/type.gotpl | 9 +- 10 files changed, 228 insertions(+), 5 deletions(-) create mode 100644 codegen/testserver/ptr_to_slice.go create mode 100644 codegen/testserver/ptr_to_slice.graphql create mode 100644 codegen/testserver/ptr_to_slice_test.go diff --git a/TESTING.md b/TESTING.md index ad7e63352ac..72ba06056c6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -5,7 +5,7 @@ Testing generated code is a little tricky, heres how its currently set up. ### Testing responses from a server -There is a server in `codegen/testserver` that is generated as part +There is a server in `codegen/testserver` that is generated as part of `go generate ./...`, and tests written against it. There are also a bunch of tests in against the examples, feel free to take examples from there. @@ -15,7 +15,7 @@ There are also a bunch of tests in against the examples, feel free to take examp These tests are **really** slow, because they need to run the whole codegen step. Use them very sparingly. If you can, find a way to unit test it instead. -Take a look at `codegen/input_test.go` for an example. +Take a look at `codegen/testserver/input_test.go` for an example. ### Testing introspection diff --git a/codegen/config/binder.go b/codegen/config/binder.go index 2be7b7bdd6b..6de7ae117a3 100644 --- a/codegen/config/binder.go +++ b/codegen/config/binder.go @@ -217,6 +217,14 @@ func (t *TypeReference) IsSlice() bool { return t.GQL.Elem != nil && isSlice } +func (t *TypeReference) IsPtrToSlice() bool { + if t.IsPtr() { + _, isPointerToSlice := t.GO.(*types.Pointer).Elem().(*types.Slice) + return isPointerToSlice + } + return false +} + func (t *TypeReference) IsNamed() bool { _, isSlice := t.GO.(*types.Named) return isSlice diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 3064d382784..c39877b90f1 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -256,6 +256,10 @@ type ComplexityRoot struct { Value func(childComplexity int) int } + PtrToSliceContainer struct { + PtrToSlice func(childComplexity int) int + } + Query struct { Animal func(childComplexity int) int Autobind func(childComplexity int) int @@ -302,6 +306,7 @@ type ComplexityRoot struct { Panics func(childComplexity int) int PrimitiveObject func(childComplexity int) int PrimitiveStringObject func(childComplexity int) int + PtrToSliceContainer func(childComplexity int) int Recursive func(childComplexity int, input *RecursiveInputSlice) int ScalarSlice func(childComplexity int) int ShapeUnion func(childComplexity int) int @@ -476,6 +481,7 @@ type QueryResolver interface { Panics(ctx context.Context) (*Panics, error) PrimitiveObject(ctx context.Context) ([]Primitive, error) PrimitiveStringObject(ctx context.Context) ([]PrimitiveString, error) + PtrToSliceContainer(ctx context.Context) (*PtrToSliceContainer, error) DefaultScalar(ctx context.Context, arg string) (string, error) Slices(ctx context.Context) (*Slices, error) ScalarSlice(ctx context.Context) ([]byte, error) @@ -1028,6 +1034,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PrimitiveString.Value(childComplexity), true + case "PtrToSliceContainer.ptrToSlice": + if e.complexity.PtrToSliceContainer.PtrToSlice == nil { + break + } + + return e.complexity.PtrToSliceContainer.PtrToSlice(childComplexity), true + case "Query.animal": if e.complexity.Query.Animal == nil { break @@ -1423,6 +1436,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.PrimitiveStringObject(childComplexity), true + case "Query.ptrToSliceContainer": + if e.complexity.Query.PtrToSliceContainer == nil { + break + } + + return e.complexity.Query.PtrToSliceContainer(childComplexity), true + case "Query.recursive": if e.complexity.Query.Recursive == nil { break @@ -2146,6 +2166,14 @@ type PrimitiveString { doubled: String! len: Int! } +`, BuiltIn: false}, + {Name: "ptr_to_slice.graphql", Input: `type PtrToSliceContainer { + ptrToSlice: [String!] +} + +extend type Query { + ptrToSliceContainer: PtrToSliceContainer! +} `, BuiltIn: false}, {Name: "scalar_default.graphql", Input: `extend type Query { defaultScalar(arg: DefaultScalarImplementation! = "default"): DefaultScalarImplementation! @@ -5811,6 +5839,35 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap return ec.marshalNInt2int(ctx, field.Selections, res) } +func (ec *executionContext) _PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField, obj *PtrToSliceContainer) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "PtrToSliceContainer", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PtrToSlice, nil + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*[]string) + fc.Result = res + return ec.marshalOString2ᚖᚕstringᚄ(ctx, field.Selections, res) +} + func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -7497,6 +7554,38 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi return ec.marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitiveStringᚄ(ctx, field.Selections, res) } +func (ec *executionContext) _Query_ptrToSliceContainer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().PtrToSliceContainer(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*PtrToSliceContainer) + fc.Result = res + return ec.marshalNPtrToSliceContainer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPtrToSliceContainer(ctx, field.Selections, res) +} + func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -12042,6 +12131,30 @@ func (ec *executionContext) _PrimitiveString(ctx context.Context, sel ast.Select return out } +var ptrToSliceContainerImplementors = []string{"PtrToSliceContainer"} + +func (ec *executionContext) _PtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, obj *PtrToSliceContainer) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, ptrToSliceContainerImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PtrToSliceContainer") + case "ptrToSlice": + out.Values[i] = ec._PtrToSliceContainer_ptrToSlice(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -12607,6 +12720,20 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } return res }) + case "ptrToSliceContainer": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_ptrToSliceContainer(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) case "defaultScalar": field := field out.Concurrently(i, func() (res graphql.Marshaler) { @@ -13856,6 +13983,20 @@ func (ec *executionContext) marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designs return ret } +func (ec *executionContext) marshalNPtrToSliceContainer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v PtrToSliceContainer) graphql.Marshaler { + return ec._PtrToSliceContainer(ctx, sel, &v) +} + +func (ec *executionContext) marshalNPtrToSliceContainer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v *PtrToSliceContainer) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._PtrToSliceContainer(ctx, sel, v) +} + func (ec *executionContext) unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx context.Context, v interface{}) (RecursiveInputSlice, error) { res, err := ec.unmarshalInputRecursiveInputSlice(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -15118,6 +15259,18 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as return graphql.MarshalString(*v) } +func (ec *executionContext) unmarshalOString2ᚖᚕstringᚄ(ctx context.Context, v interface{}) (*[]string, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v *[]string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, sel, *v) +} + func (ec *executionContext) marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐTestUnion(ctx context.Context, sel ast.SelectionSet, v TestUnion) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/codegen/testserver/ptr_to_slice.go b/codegen/testserver/ptr_to_slice.go new file mode 100644 index 00000000000..b16bf48890f --- /dev/null +++ b/codegen/testserver/ptr_to_slice.go @@ -0,0 +1,5 @@ +package testserver + +type PtrToSliceContainer struct { + PtrToSlice *[]string +} diff --git a/codegen/testserver/ptr_to_slice.graphql b/codegen/testserver/ptr_to_slice.graphql new file mode 100644 index 00000000000..b773d83d428 --- /dev/null +++ b/codegen/testserver/ptr_to_slice.graphql @@ -0,0 +1,7 @@ +type PtrToSliceContainer { + ptrToSlice: [String!] +} + +extend type Query { + ptrToSliceContainer: PtrToSliceContainer! +} diff --git a/codegen/testserver/ptr_to_slice_test.go b/codegen/testserver/ptr_to_slice_test.go new file mode 100644 index 00000000000..2fe498feb8c --- /dev/null +++ b/codegen/testserver/ptr_to_slice_test.go @@ -0,0 +1,37 @@ +package testserver + +import ( + "context" + "testing" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/stretchr/testify/require" +) + +func TestPtrToSlice(t *testing.T) { + resolvers := &Stub{} + + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) + + resolvers.QueryResolver.PtrToSliceContainer = func(ctx context.Context) (wrappedStruct *PtrToSliceContainer, e error) { + ptrToSliceContainer := PtrToSliceContainer{ + PtrToSlice: &[]string{"hello"}, + } + return &ptrToSliceContainer, nil + } + + t.Run("pointer to slice", func(t *testing.T) { + var resp struct { + PtrToSliceContainer struct { + PtrToSlice []string + } + } + + err := c.Post(`query { ptrToSliceContainer { ptrToSlice }}`, &resp) + require.NoError(t, err) + + require.Equal(t, []string{"hello"}, resp.PtrToSliceContainer.PtrToSlice) + + }) +} diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index 867f692c1dd..ed813bf511e 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -260,6 +260,10 @@ func (r *queryResolver) PrimitiveStringObject(ctx context.Context) ([]PrimitiveS panic("not implemented") } +func (r *queryResolver) PtrToSliceContainer(ctx context.Context) (*PtrToSliceContainer, error) { + panic("not implemented") +} + func (r *queryResolver) DefaultScalar(ctx context.Context, arg string) (string, error) { panic("not implemented") } diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index 051f1919534..8b6d7671a26 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -92,6 +92,7 @@ type Stub struct { Panics func(ctx context.Context) (*Panics, error) PrimitiveObject func(ctx context.Context) ([]Primitive, error) PrimitiveStringObject func(ctx context.Context) ([]PrimitiveString, error) + PtrToSliceContainer func(ctx context.Context) (*PtrToSliceContainer, error) DefaultScalar func(ctx context.Context, arg string) (string, error) Slices func(ctx context.Context) (*Slices, error) ScalarSlice func(ctx context.Context) ([]byte, error) @@ -383,6 +384,9 @@ func (r *stubQuery) PrimitiveObject(ctx context.Context) ([]Primitive, error) { func (r *stubQuery) PrimitiveStringObject(ctx context.Context) ([]PrimitiveString, error) { return r.QueryResolver.PrimitiveStringObject(ctx) } +func (r *stubQuery) PtrToSliceContainer(ctx context.Context) (*PtrToSliceContainer, error) { + return r.QueryResolver.PtrToSliceContainer(ctx) +} func (r *stubQuery) DefaultScalar(ctx context.Context, arg string) (string, error) { return r.QueryResolver.DefaultScalar(ctx, arg) } diff --git a/codegen/type.go b/codegen/type.go index 06b370be7f2..5a059d70131 100644 --- a/codegen/type.go +++ b/codegen/type.go @@ -26,7 +26,7 @@ func processType(ret map[string]*config.TypeReference, ref *config.TypeReference } ret[key] = ref - if ref.IsSlice() { + if ref.IsSlice() || ref.IsPtrToSlice() { processType(ret, ref.Elem()) } } diff --git a/codegen/type.gotpl b/codegen/type.gotpl index 85a7cf6a5f2..9c421b02d3d 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -4,7 +4,10 @@ {{- if and $type.IsNilable (not $type.GQL.NonNull) }} if v == nil { return nil, nil } {{- end }} - {{- if $type.IsSlice }} + {{- if $type.IsPtrToSlice }} + res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) + {{- else if $type.IsSlice }} var vSlice []interface{} if v != nil { if tmp1, ok := v.([]interface{}); ok { @@ -66,7 +69,9 @@ {{ with $type.MarshalFunc }} func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler { - {{- if $type.IsSlice }} + {{- if $type.IsPtrToSlice }} + return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) + {{- else if $type.IsSlice }} {{- if not $type.GQL.NonNull }} if v == nil { return graphql.Null From f57d1a0285eebce853a6a008da3c9c7b4eb77c57 Mon Sep 17 00:00:00 2001 From: Luke Cawood Date: Tue, 13 Apr 2021 12:24:50 +1000 Subject: [PATCH 31/50] Bump gqlparser to master & support repeated directives --- codegen/testserver/directive.graphql | 4 +- codegen/testserver/directive_test.go | 5 +- codegen/testserver/generated.go | 63 ++++++++++++++++--- example/chat/generated.go | 40 ++++++++++++ example/config/generated.go | 40 ++++++++++++ example/dataloader/generated.go | 40 ++++++++++++ .../accounts/graph/generated/generated.go | 40 ++++++++++++ .../products/graph/generated/generated.go | 40 ++++++++++++ .../reviews/graph/generated/generated.go | 40 ++++++++++++ example/fileupload/generated.go | 40 ++++++++++++ example/scalars/generated.go | 40 ++++++++++++ example/selection/generated.go | 40 ++++++++++++ example/starwars/generated/exec.go | 40 ++++++++++++ example/todo/generated.go | 37 +++++++++++ example/type-system-extension/generated.go | 40 ++++++++++++ go.mod | 2 +- go.sum | 6 +- graphql/introspection/introspection.go | 9 +-- graphql/introspection/schema.go | 9 +-- integration/generated.go | 40 ++++++++++++ 20 files changed, 590 insertions(+), 25 deletions(-) diff --git a/codegen/testserver/directive.graphql b/codegen/testserver/directive.graphql index 4005cfd8907..f878c4d5cf7 100644 --- a/codegen/testserver/directive.graphql +++ b/codegen/testserver/directive.graphql @@ -6,7 +6,7 @@ directive @toNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINI directive @directive1 on FIELD_DEFINITION directive @directive2 on FIELD_DEFINITION directive @unimplemented on FIELD_DEFINITION -directive @order1(location: String!) on FIELD_DEFINITION | OBJECT +directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT directive @order2(location: String!) on OBJECT extend type Query { @@ -42,7 +42,7 @@ input InnerDirectives { message: String! @length(min: 1, message: "not valid") } -type ObjectDirectives @order1(location: "ObjectDirectives_object_1") @order2(location: "ObjectDirectives_object_2") { +type ObjectDirectives @order1(location: "order1_1") @order1(location: "order1_2") @order2(location: "order2_1") { text: String! @length(min: 0, max: 7, message: "not valid") nullableText: String @toNull order: [String!]! diff --git a/codegen/testserver/directive_test.go b/codegen/testserver/directive_test.go index 32015005104..56786f58037 100644 --- a/codegen/testserver/directive_test.go +++ b/codegen/testserver/directive_test.go @@ -387,8 +387,9 @@ func TestDirectives(t *testing.T) { require.Equal(t, "Ok", resp.DirectiveObject.Text) require.True(t, resp.DirectiveObject.NullableText == nil) require.Equal(t, "Query_field", resp.DirectiveObject.Order[0]) - require.Equal(t, "ObjectDirectives_object_2", resp.DirectiveObject.Order[1]) - require.Equal(t, "ObjectDirectives_object_1", resp.DirectiveObject.Order[2]) + require.Equal(t, "order2_1", resp.DirectiveObject.Order[1]) + require.Equal(t, "order1_2", resp.DirectiveObject.Order[2]) + require.Equal(t, "order1_1", resp.DirectiveObject.Order[3]) }) t.Run("when directive returns nil & custom go field is not nilable", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index c39877b90f1..7de02ba888b 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1915,7 +1915,7 @@ directive @toNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINI directive @directive1 on FIELD_DEFINITION directive @directive2 on FIELD_DEFINITION directive @unimplemented on FIELD_DEFINITION -directive @order1(location: String!) on FIELD_DEFINITION | OBJECT +directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT directive @order2(location: String!) on OBJECT extend type Query { @@ -1951,7 +1951,7 @@ input InnerDirectives { message: String! @length(min: 1, message: "not valid") } -type ObjectDirectives @order1(location: "ObjectDirectives_object_1") @order2(location: "ObjectDirectives_object_2") { +type ObjectDirectives @order1(location: "order1_1") @order1(location: "order1_2") @order2(location: "order2_1") { text: String! @length(min: 0, max: 7, message: "not valid") nullableText: String @toNull order: [String!]! @@ -6569,7 +6569,7 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr return ec.resolvers.Query().DirectiveObject(rctx) } directive1 := func(ctx context.Context) (interface{}, error) { - location, err := ec.unmarshalNString2string(ctx, "ObjectDirectives_object_1") + location, err := ec.unmarshalNString2string(ctx, "order1_1") if err != nil { return nil, err } @@ -6579,16 +6579,26 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr return ec.directives.Order1(ctx, nil, directive0, location) } directive2 := func(ctx context.Context) (interface{}, error) { - location, err := ec.unmarshalNString2string(ctx, "ObjectDirectives_object_2") + location, err := ec.unmarshalNString2string(ctx, "order1_2") + if err != nil { + return nil, err + } + if ec.directives.Order1 == nil { + return nil, errors.New("directive order1 is not implemented") + } + return ec.directives.Order1(ctx, nil, directive1, location) + } + directive3 := func(ctx context.Context) (interface{}, error) { + location, err := ec.unmarshalNString2string(ctx, "order2_1") if err != nil { return nil, err } if ec.directives.Order2 == nil { return nil, errors.New("directive order2 is not implemented") } - return ec.directives.Order2(ctx, nil, directive1, location) + return ec.directives.Order2(ctx, nil, directive2, location) } - directive3 := func(ctx context.Context) (interface{}, error) { + directive4 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "Query_field") if err != nil { return nil, err @@ -6596,10 +6606,10 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr if ec.directives.Order1 == nil { return nil, errors.New("directive order1 is not implemented") } - return ec.directives.Order1(ctx, nil, directive2, location) + return ec.directives.Order1(ctx, nil, directive3, location) } - tmp, err := directive3(rctx) + tmp, err := directive4(rctx) if err != nil { return nil, graphql.ErrorOnPath(ctx, err) } @@ -9243,6 +9253,38 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -13319,6 +13361,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/chat/generated.go b/example/chat/generated.go index 9d162affae0..7ebbf06eb47 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -1010,6 +1010,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2162,6 +2197,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/config/generated.go b/example/config/generated.go index 00a1145a3ea..38b43adb236 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -857,6 +857,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2034,6 +2069,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 342ac7cc389..7ede23b8b1a 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -1120,6 +1120,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2335,6 +2370,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/federation/accounts/graph/generated/generated.go b/example/federation/accounts/graph/generated/generated.go index 1d64bbeda50..52adf8bb3c5 100644 --- a/example/federation/accounts/graph/generated/generated.go +++ b/example/federation/accounts/graph/generated/generated.go @@ -785,6 +785,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -1952,6 +1987,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/federation/products/graph/generated/generated.go b/example/federation/products/graph/generated/generated.go index 92c126f7aa3..5f544afd645 100644 --- a/example/federation/products/graph/generated/generated.go +++ b/example/federation/products/graph/generated/generated.go @@ -856,6 +856,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2028,6 +2063,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/federation/reviews/graph/generated/generated.go b/example/federation/reviews/graph/generated/generated.go index 192d961498f..0ef7c35a9e9 100644 --- a/example/federation/reviews/graph/generated/generated.go +++ b/example/federation/reviews/graph/generated/generated.go @@ -1043,6 +1043,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2301,6 +2336,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index bb3f308cfc1..c8f57b81246 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -936,6 +936,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2082,6 +2117,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 0773ab3b4dd..5e8060bdf98 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -1194,6 +1194,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2391,6 +2426,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/selection/generated.go b/example/selection/generated.go index ddbd977d5d2..bc3c24d4442 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -786,6 +786,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -1908,6 +1943,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index d82d169b60b..5b6b13b20ac 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -2532,6 +2532,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -4094,6 +4129,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/todo/generated.go b/example/todo/generated.go index 2e5ceeb2300..9cf43c496a4 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -988,6 +988,38 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2054,6 +2086,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index eb50a955fc6..c09547397ee 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -922,6 +922,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2088,6 +2123,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/go.mod b/go.mod index f77773be11e..44dc5d01616 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/stretchr/testify v1.4.0 github.com/urfave/cli/v2 v2.1.1 github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e - github.com/vektah/gqlparser/v2 v2.1.0 + github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4 golang.org/x/tools v0.0.0-20210106214847-113979e3529a gopkg.in/yaml.v2 v2.2.4 sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 diff --git a/go.sum b/go.sum index 6dbb9486152..b2cb620c44e 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWpEAyDlU1eKOuk5twTjAjuevXqcJJw8hrg= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= -github.com/vektah/gqlparser/v2 v2.1.0 h1:uiKJ+T5HMGGQM2kRKQ8Pxw8+Zq9qhhZhz/lieYvCMns= -github.com/vektah/gqlparser/v2 v2.1.0/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4XkV2se04Px1Ms= +github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4 h1:Dvl56VBDvea05rrO4g2PjAiNXiBnSBzy0G4rRGJEgo8= +github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4/go.mod h1:i3mQIGIrbK2PD1RrCeMTlVbkF2FJ6WkU1KJlJlC+3F4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -81,7 +81,6 @@ golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= @@ -92,7 +91,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/graphql/introspection/introspection.go b/graphql/introspection/introspection.go index 5239c92839e..709fa962630 100644 --- a/graphql/introspection/introspection.go +++ b/graphql/introspection/introspection.go @@ -5,10 +5,11 @@ import "github.com/vektah/gqlparser/v2/ast" type ( Directive struct { - Name string - Description string - Locations []string - Args []InputValue + Name string + Description string + Locations []string + Args []InputValue + IsRepeatable bool } EnumValue struct { diff --git a/graphql/introspection/schema.go b/graphql/introspection/schema.go index 044e91d6e98..af56eff4205 100644 --- a/graphql/introspection/schema.go +++ b/graphql/introspection/schema.go @@ -60,9 +60,10 @@ func (s *Schema) directiveFromDef(d *ast.DirectiveDefinition) Directive { } return Directive{ - Name: d.Name, - Description: d.Description, - Locations: locs, - Args: args, + Name: d.Name, + Description: d.Description, + Locations: locs, + Args: args, + IsRepeatable: d.IsRepeatable, } } diff --git a/integration/generated.go b/integration/generated.go index 94a65076232..516e2da4d03 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -1061,6 +1061,41 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -2324,6 +2359,11 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { invalids++ } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } From 1d768a29c960df5d54f6e675e0338619d5b04bfd Mon Sep 17 00:00:00 2001 From: Luke Cawood Date: Tue, 13 Apr 2021 12:38:17 +1000 Subject: [PATCH 32/50] Add test covering single element -> slice coercion --- codegen/testserver/input_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/codegen/testserver/input_test.go b/codegen/testserver/input_test.go index 1a54508d721..aaba53aa668 100644 --- a/codegen/testserver/input_test.go +++ b/codegen/testserver/input_test.go @@ -46,4 +46,24 @@ func TestInput(t *testing.T) { require.NoError(t, err) require.False(t, resp.InputNullableSlice) }) + + t.Run("coerce single value to slice", func(t *testing.T) { + check := func(ctx context.Context, arg []string) (b bool, e error) { + return len(arg) == 1 && arg[0] == "coerced", nil + } + resolvers.QueryResolver.InputSlice = check + resolvers.QueryResolver.InputNullableSlice = check + + var resp struct { + Coerced bool + } + var err error + err = c.Post(`query { coerced: inputSlice(arg: "coerced") }`, &resp) + require.NoError(t, err) + require.True(t, resp.Coerced) + + err = c.Post(`query { coerced: inputNullableSlice(arg: "coerced") }`, &resp) + require.NoError(t, err) + require.True(t, resp.Coerced) + }) } From 4e881981de33f2e2bf1fef11c2bf833995f60719 Mon Sep 17 00:00:00 2001 From: Luke Cawood Date: Tue, 13 Apr 2021 16:35:43 +1000 Subject: [PATCH 33/50] Bump to gqlparser v2.2.0 --- go.mod | 4 ++-- go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 44dc5d01616..bbd03943083 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/99designs/gqlgen go 1.12 require ( - github.com/agnivade/levenshtein v1.0.3 // indirect + github.com/agnivade/levenshtein v1.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect github.com/gorilla/mux v1.6.1 // indirect @@ -23,7 +23,7 @@ require ( github.com/stretchr/testify v1.4.0 github.com/urfave/cli/v2 v2.1.1 github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e - github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4 + github.com/vektah/gqlparser/v2 v2.2.0 golang.org/x/tools v0.0.0-20210106214847-113979e3529a gopkg.in/yaml.v2 v2.2.4 sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 diff --git a/go.sum b/go.sum index b2cb620c44e..fe1fd7471b6 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/agnivade/levenshtein v1.0.3 h1:M5ZnqLOoZR8ygVq0FfkXsNOKzMCk0xRiow0R5+5VkQ0= -github.com/agnivade/levenshtein v1.0.3/go.mod h1:4SFRZbbXWLF4MU1T9Qg0pGgH3Pjs+t6ie5efyrwRJXs= +github.com/agnivade/levenshtein v1.1.0 h1:n6qGwyHG61v3ABce1rPVZklEYRT8NFpCMrpZdBUbYGM= +github.com/agnivade/levenshtein v1.1.0/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= @@ -11,8 +11,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c h1:TUuUh0Xgj97tLMNtWtNvI9mIV6isjEb9lBMNv+77IGM= -github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk= @@ -69,8 +69,8 @@ github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWpEAyDlU1eKOuk5twTjAjuevXqcJJw8hrg= github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U= -github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4 h1:Dvl56VBDvea05rrO4g2PjAiNXiBnSBzy0G4rRGJEgo8= -github.com/vektah/gqlparser/v2 v2.1.1-0.20210413003740-7cc8073a56b4/go.mod h1:i3mQIGIrbK2PD1RrCeMTlVbkF2FJ6WkU1KJlJlC+3F4= +github.com/vektah/gqlparser/v2 v2.2.0 h1:bAc3slekAAJW6sZTi07aGq0OrfaCjj4jxARAaC7g2EM= +github.com/vektah/gqlparser/v2 v2.2.0/go.mod h1:i3mQIGIrbK2PD1RrCeMTlVbkF2FJ6WkU1KJlJlC+3F4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= From bb59cc43aa5bae2595ec823f8d7e67369e990082 Mon Sep 17 00:00:00 2001 From: Michael Compton Date: Thu, 15 Apr 2021 10:58:11 +1000 Subject: [PATCH 34/50] Add a CHANGELOG.md (#1512) --- CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..263ebc3eb64 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,43 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +* Added a changelog :-) Following the same style as [Apollo Client](https://github.com/apollographql/apollo-client) because that feels like it gives good thanks to the community contributors.
+By [@MichaelJCompton](https://github.com/MichaelJCompton) in [#1512](https://github.com/99designs/gqlgen/pull/1512) +* Added support for methods returning `(v, ok)` shaped values to support Prisma Go client.
+By [@steebchen](https://github.com/steebchen) in [#1449](https://github.com/99designs/gqlgen/pull/1449) + +### Changed + +* Updated to gqlparser to v2.2.0.
+By [@lwc](https://github.com/lwc) in [#1514](https://github.com/99designs/gqlgen/pull/1514) +* GraphQL playground updated to 1.7.26.
+By [@ddouglas](https://github.com/ddouglas) in [#1436](https://github.com/99designs/gqlgen/pull/1436) + +### Fixed + +* Removed a data race by copying when input fields have default values. +Bu [@skaji](https://github.com/skaji) in [#1456](https://github.com/99designs/gqlgen/pull/1456) +* v0.12.2 broke the handling of pointers to slices by calling the custom Marshal and Unmarshal functions on the entire slice. It now correctly calls the custom Marshal and Unmarshal methods for each element in the slice.
+By [@ananyasaxena](https://github.com/ananyasaxena) in [#1363](https://github.com/99designs/gqlgen/pull/1363) +* Changes in go1.16 that mean go.mod and go.sum aren't always up to date. Now `go mod tidy` is run after code generation.
+By [@lwc](https://github.com/lwc) in [#1501](https://github.com/99designs/gqlgen/pull/1501) +* Errors in resolving non-nullable arrays were not correctly bubbling up to the next nullable field.
+By [@wilhelmeek](https://github.com/wilhelmeek) in [#1480](https://github.com/99designs/gqlgen/pull/1480) +* Fixed a potential deadlock in calling error presenters.
+By [@vektah](https://github.com/vektah) in [#1399](https://github.com/99designs/gqlgen/pull/1399) +* Fixed `collectFields` not correctly respecting alias fields in fragments.
+By [@vmrajas](https://github.com/vmrajas) in [#1341](https://github.com/99designs/gqlgen/pull/1341) + + +## [0.13.0] - 2020-09-21 + +Base version at which changelog was introduced. + From 5ad012e3d7be1127706b9c8a3da0378df3a98ec1 Mon Sep 17 00:00:00 2001 From: MichaelJCompton Date: Thu, 15 Apr 2021 16:58:09 +1000 Subject: [PATCH 35/50] Revert "Merge pull request #1511 from a8m/a8m/restore-cwd" This reverts commit f4bf1f591b6a3884041876deb64ce0dd70c3c883, reversing changes made to 3f68ea27a1a9fea2064caf877f7e24d00aa439e6. Reverting this because it will break existing setups, moving where generated files get put. --- codegen/config/config.go | 24 +++++++++--------------- codegen/config/config_test.go | 5 ----- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/codegen/config/config.go b/codegen/config/config.go index 24ea9e7ef04..ba939fcf59a 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -70,8 +70,8 @@ func LoadDefaultConfig() (*Config, error) { // LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories // walking up the tree. The closest config file will be returned. -func LoadConfigFromDefaultLocations() (cfg *Config, err error) { - cfgFile, cwd, err := findCfg() +func LoadConfigFromDefaultLocations() (*Config, error) { + cfgFile, err := findCfg() if err != nil { return nil, err } @@ -80,12 +80,6 @@ func LoadConfigFromDefaultLocations() (cfg *Config, err error) { if err != nil { return nil, errors.Wrap(err, "unable to enter config dir") } - defer func() { - if cerr := os.Chdir(cwd); cerr != nil { - cfg = nil - err = errors.Wrap(cerr, "unable to restore working directory") - } - }() return LoadConfig(cfgFile) } @@ -473,24 +467,24 @@ func inStrSlice(haystack []string, needle string) bool { // findCfg searches for the config file in this directory and all parents up the tree // looking for the closest match -func findCfg() (string, string, error) { - cwd, err := os.Getwd() +func findCfg() (string, error) { + dir, err := os.Getwd() if err != nil { - return "", "", errors.Wrap(err, "unable to get working dir to findCfg") + return "", errors.Wrap(err, "unable to get working dir to findCfg") } - cfg := findCfgInDir(cwd) + cfg := findCfgInDir(dir) - for dir := cwd; cfg == "" && dir != filepath.Dir(dir); { + for cfg == "" && dir != filepath.Dir(dir) { dir = filepath.Dir(dir) cfg = findCfgInDir(dir) } if cfg == "" { - return "", "", os.ErrNotExist + return "", os.ErrNotExist } - return cfg, cwd, nil + return cfg, nil } func findCfgInDir(dir string) string { diff --git a/codegen/config/config_test.go b/codegen/config/config_test.go index de63b15d3f0..b16e90c11a5 100644 --- a/codegen/config/config_test.go +++ b/codegen/config/config_test.go @@ -72,14 +72,9 @@ func TestLoadConfigFromDefaultLocation(t *testing.T) { err = os.Chdir(filepath.Join(testDir, "testdata", "cfg", "otherdir")) require.NoError(t, err) - before, err := os.Getwd() - require.NoError(t, err) cfg, err = LoadConfigFromDefaultLocations() require.NoError(t, err) require.Equal(t, StringList{"outer"}, cfg.SchemaFilename) - after, err := os.Getwd() - require.NoError(t, err) - require.Equal(t, before, after) }) t.Run("will return error if config doesn't exist", func(t *testing.T) { From 843edd9ea507bcf50b02cb43d0543f3fdf0ae875 Mon Sep 17 00:00:00 2001 From: Shivang Goswami Date: Mon, 19 Apr 2021 19:34:31 +0530 Subject: [PATCH 36/50] Update apq.md function definition mismatch line 67: cache, err := NewCache(cfg.RedisAddress, 24*time.Hour) line 41: func NewCache(redisAddress string, password string,ttl time.Duration) (*Cache, error) either password should be removed from 41 or added in line 67 Proposed the first one for now. --- docs/content/reference/apq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/apq.md b/docs/content/reference/apq.md index 2be30fa2429..b5cd6fc12c9 100644 --- a/docs/content/reference/apq.md +++ b/docs/content/reference/apq.md @@ -38,7 +38,7 @@ type Cache struct { const apqPrefix = "apq:" -func NewCache(redisAddress string, password string, ttl time.Duration) (*Cache, error) { +func NewCache(redisAddress string, ttl time.Duration) (*Cache, error) { client := redis.NewClient(&redis.Options{ Addr: redisAddress, }) From 145101e439f5460cbe7e85f8618e4de74104b676 Mon Sep 17 00:00:00 2001 From: Dany Henriquez <2287263+DanyHenriquez@users.noreply.github.com> Date: Fri, 2 Jul 2021 16:58:44 +0200 Subject: [PATCH 37/50] Update apq.md --- docs/content/reference/apq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/apq.md b/docs/content/reference/apq.md index 2be30fa2429..97dd2c3f549 100644 --- a/docs/content/reference/apq.md +++ b/docs/content/reference/apq.md @@ -14,7 +14,7 @@ to register query hash with original query on a server. ## Usage In order to enable Automatic Persisted Queries you need to change your client. For more information see -[Automatic Persisted Queries Link](https://github.com/apollographql/apollo-link-persisted-queries) documentation. +[Automatic Persisted Queries Link](https://www.apollographql.com/docs/react/api/link/persisted-queries/) documentation. For the server you need to implement the `graphql.Cache` interface and pass an instance to the `extension.AutomaticPersistedQuery` type. Make sure the extension is applied to your GraphQL handler. From 3e45ddc151232c5d05eb719f4722a9306f06afa1 Mon Sep 17 00:00:00 2001 From: talhaguy Date: Sun, 18 Jul 2021 11:34:46 -0700 Subject: [PATCH 38/50] Correct minor casing issue --- docs/content/reference/dataloaders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/dataloaders.md b/docs/content/reference/dataloaders.md index d5ece00e21a..775042eb2ca 100644 --- a/docs/content/reference/dataloaders.md +++ b/docs/content/reference/dataloaders.md @@ -157,7 +157,7 @@ func (r *todoResolver) UserLoader(ctx context.Context, obj *model.Todo) (*model. } ``` -The end result? just 2 queries! +The end result? Just 2 queries! ```sql SELECT id, todo, user_id FROM todo SELECT id, name from user WHERE id IN (?,?,?,?,?) From be9a0791a9217a05e105914dbae11e29a651ea54 Mon Sep 17 00:00:00 2001 From: Dany Henriquez <2287263+DanyHenriquez@users.noreply.github.com> Date: Sun, 25 Jul 2021 11:07:00 +0200 Subject: [PATCH 39/50] Update apq.md --- docs/content/reference/apq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/apq.md b/docs/content/reference/apq.md index 97dd2c3f549..e8d59bd377d 100644 --- a/docs/content/reference/apq.md +++ b/docs/content/reference/apq.md @@ -14,7 +14,7 @@ to register query hash with original query on a server. ## Usage In order to enable Automatic Persisted Queries you need to change your client. For more information see -[Automatic Persisted Queries Link](https://www.apollographql.com/docs/react/api/link/persisted-queries/) documentation. +[Automatic Persisted Queries Link](https://www.apollographql.com/docs/resources/graphql-glossary/#automatic-persisted-queries-apq) documentation. For the server you need to implement the `graphql.Cache` interface and pass an instance to the `extension.AutomaticPersistedQuery` type. Make sure the extension is applied to your GraphQL handler. From eb36f04ffde9a706467839b0aadb5671e4ed16a9 Mon Sep 17 00:00:00 2001 From: Nathan Yergler Date: Tue, 23 Mar 2021 11:19:58 -0700 Subject: [PATCH 40/50] Return introspection document in stable order This avoids spurious changes when generating client code using something like graphql-codegen. --- graphql/introspection/schema.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/graphql/introspection/schema.go b/graphql/introspection/schema.go index 044e91d6e98..91896045127 100644 --- a/graphql/introspection/schema.go +++ b/graphql/introspection/schema.go @@ -1,6 +1,7 @@ package introspection import ( + "sort" "strings" "github.com/vektah/gqlparser/v2/ast" @@ -11,12 +12,20 @@ type Schema struct { } func (s *Schema) Types() []Type { - types := make([]Type, 0, len(s.schema.Types)) + typeIndex := map[string]Type{} + typeNames := make([]string, 0, len(s.schema.Types)) for _, typ := range s.schema.Types { if strings.HasPrefix(typ.Name, "__") { continue } - types = append(types, *WrapTypeFromDef(s.schema, typ)) + typeNames = append(typeNames, typ.Name) + typeIndex[typ.Name] = *WrapTypeFromDef(s.schema, typ) + } + sort.Strings(typeNames) + + types := make([]Type, len(typeNames)) + for i, t := range typeNames { + types[i] = typeIndex[t] } return types } @@ -34,10 +43,18 @@ func (s *Schema) SubscriptionType() *Type { } func (s *Schema) Directives() []Directive { - res := make([]Directive, 0, len(s.schema.Directives)) + dIndex := map[string]Directive{} + dNames := make([]string, 0, len(s.schema.Directives)) for _, d := range s.schema.Directives { - res = append(res, s.directiveFromDef(d)) + dNames = append(dNames, d.Name) + dIndex[d.Name] = s.directiveFromDef(d) + } + sort.Strings(dNames) + + res := make([]Directive, len(dNames)) + for i, d := range dNames { + res[i] = dIndex[d] } return res From 01b25c5534453574296c52065c04d1923b3607c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 19:14:23 +0000 Subject: [PATCH 41/50] Bump path-parse from 1.0.6 to 1.0.7 in /integration Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 95a128a71b0..35bf5d4232e 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -8908,9 +8908,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-to-regexp": { From 29133c1152b4d89ab897bf75e0114fffad32351e Mon Sep 17 00:00:00 2001 From: Aaron M Date: Sat, 14 Aug 2021 08:41:37 -0600 Subject: [PATCH 42/50] Fix spaces -> tabs typo in authentication.md The indentation here was supposed to be a tab rather than spaces so the readme was off. --- docs/content/recipes/authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/recipes/authentication.md b/docs/content/recipes/authentication.md index 6ae59e73b8d..c77f5d9dd07 100644 --- a/docs/content/recipes/authentication.md +++ b/docs/content/recipes/authentication.md @@ -88,7 +88,7 @@ func main() { router.Use(auth.Middleware(db)) - srv := handler.NewDefaultServer(starwars.NewExecutableSchema(starwars.NewResolver())) + srv := handler.NewDefaultServer(starwars.NewExecutableSchema(starwars.NewResolver())) router.Handle("/", playground.Handler("Starwars", "/query")) router.Handle("/query", srv) From edf630a3da614949b9f0246299b08a61d25f6635 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 18:37:14 +0000 Subject: [PATCH 43/50] Bump tar from 6.0.5 to 6.1.11 in /integration Bumps [tar](https://github.com/npm/node-tar) from 6.0.5 to 6.1.11. - [Release notes](https://github.com/npm/node-tar/releases) - [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-tar/compare/v6.0.5...v6.1.11) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 95a128a71b0..bdc8a3e830c 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -10177,9 +10177,9 @@ "dev": true }, "tar": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz", - "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==", + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", "dev": true, "requires": { "chownr": "^2.0.0", From 721158f3cdb00744c33380c05ab020f31b894325 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:42 +0000 Subject: [PATCH 44/50] Bump ws from 7.3.1 to 7.4.6 in /integration Bumps [ws](https://github.com/websockets/ws) from 7.3.1 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.3.1...7.4.6) --- updated-dependencies: - dependency-name: ws dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- integration/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..90b2b47a0b9 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -11037,9 +11037,9 @@ } }, "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==", + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true }, "xdg-basedir": { diff --git a/integration/package.json b/integration/package.json index 8c8c6d365b8..f2d1002335c 100644 --- a/integration/package.json +++ b/integration/package.json @@ -16,7 +16,7 @@ "jest": "^24.9.0", "node-fetch": "^2.6.0", "subscriptions-transport-ws": "^0.9.18", - "ws": "^7.3.1" + "ws": "^7.4.6" }, "dependencies": { "@babel/preset-env": "^7.11.0" From 36be94fff25cfe702f6b93a7fd595972ceb41a4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:44 +0000 Subject: [PATCH 45/50] Bump node-fetch from 2.6.0 to 2.6.1 in /integration Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.0...v2.6.1) --- updated-dependencies: - dependency-name: node-fetch dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- integration/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..1ed95a5e6fd 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -8298,9 +8298,9 @@ } }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true }, "node-int64": { diff --git a/integration/package.json b/integration/package.json index 8c8c6d365b8..c9188bc9bdc 100644 --- a/integration/package.json +++ b/integration/package.json @@ -14,7 +14,7 @@ "graphql-cli": "^3.0.14", "graphql-tag": "^2.11.0", "jest": "^24.9.0", - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "subscriptions-transport-ws": "^0.9.18", "ws": "^7.3.1" }, From 94e9406e93a5afee6f193fc936f200287c4f5847 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:46 +0000 Subject: [PATCH 46/50] Bump hosted-git-info from 2.8.5 to 2.8.9 in /integration Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.5 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.5...v2.8.9) --- updated-dependencies: - dependency-name: hosted-git-info dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..2e3615f597b 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -6218,9 +6218,9 @@ } }, "hosted-git-info": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", - "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "html-encoding-sniffer": { From 13db61111eae250a02ead0cd9faa456d98dc007b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:52 +0000 Subject: [PATCH 47/50] Bump browserslist from 4.14.0 to 4.17.0 in /integration Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.14.0 to 4.17.0. - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.14.0...4.17.0) --- updated-dependencies: - dependency-name: browserslist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 62 ++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..baaea2eb56e 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -3982,14 +3982,37 @@ } }, "browserslist": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.0.tgz", - "integrity": "sha512-pUsXKAF2lVwhmtpeA3LJrZ76jXuusrNyhduuQs7CDFf9foT4Y38aQOserd2lMe5DSSrjf3fx34oHwryuvxAUgQ==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", + "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", "requires": { - "caniuse-lite": "^1.0.30001111", - "electron-to-chromium": "^1.3.523", - "escalade": "^3.0.2", - "node-releases": "^1.1.60" + "caniuse-lite": "^1.0.30001254", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.830", + "escalade": "^3.1.1", + "node-releases": "^1.1.75" + }, + "dependencies": { + "caniuse-lite": { + "version": "1.0.30001255", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001255.tgz", + "integrity": "sha512-F+A3N9jTZL882f/fg/WWVnKSu6IOo3ueLz4zwaOPbPYHNmM/ZaDUyzyJwS1mZhX7Ex5jqTyW599Gdelh5PDYLQ==" + }, + "electron-to-chromium": { + "version": "1.3.830", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.830.tgz", + "integrity": "sha512-gBN7wNAxV5vl1430dG+XRcQhD4pIeYeak6p6rjdCtlz5wWNwDad8jwvphe5oi1chL5MV6RNRikfffBBiFuj+rQ==" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "node-releases": { + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==" + } } }, "bser": { @@ -4122,11 +4145,6 @@ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, - "caniuse-lite": { - "version": "1.0.30001119", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001119.tgz", - "integrity": "sha512-Hpwa4obv7EGP+TjkCh/wVvbtNJewxmtg4yVJBLFnxo35vbPapBr138bUWENkb5j5L9JZJ9RXLn4OrXRG/cecPQ==" - }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -4313,6 +4331,11 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, + "colorette": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", + "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==" + }, "columnify": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz", @@ -5031,11 +5054,6 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, - "electron-to-chromium": { - "version": "1.3.553", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.553.tgz", - "integrity": "sha512-wi/hoMuTGK6OJoLOHqmXFA9BWOQGF2nInCfk+/Owhd4VVfuenKE2LZr9TtFCmwyda2SE9hG+sRnqRCwhYgFeIg==" - }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -5129,11 +5147,6 @@ "es6-promise": "^4.0.3" } }, - "escalade": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz", - "integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ==" - }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -8328,11 +8341,6 @@ "which": "^1.3.0" } }, - "node-releases": { - "version": "1.1.60", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.60.tgz", - "integrity": "sha512-gsO4vjEdQaTusZAEebUWp2a5d7dF5DYoIpDG7WySnk7BuZDW+GPpHXoXXuYawRBr/9t5q54tirPz79kFIWg4dA==" - }, "node-request-by-swagger": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/node-request-by-swagger/-/node-request-by-swagger-1.1.4.tgz", From de89d3a6f28cffb44704f6f9b6876c8c81d9f7aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:54 +0000 Subject: [PATCH 48/50] Bump y18n from 3.2.1 to 3.2.2 in /integration Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) --- updated-dependencies: - dependency-name: y18n dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..3b70afefe1b 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -7037,9 +7037,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yargs": { @@ -7427,9 +7427,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yargs": { @@ -11061,9 +11061,9 @@ "dev": true }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", "dev": true }, "yallist": { From 24d8c703c122cd007fe2eb81457a2eae89b49be8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:16:57 +0000 Subject: [PATCH 49/50] Bump ini from 1.3.5 to 1.3.8 in /integration Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8. - [Release notes](https://github.com/isaacs/ini/releases) - [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8) --- updated-dependencies: - dependency-name: ini dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..9534a53be54 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -6396,9 +6396,9 @@ "dev": true }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "inquirer": { From fd133c0b7a2d552e73da63180e3af2e4bf4aa434 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 02:17:10 +0000 Subject: [PATCH 50/50] Bump normalize-url from 4.5.0 to 4.5.1 in /integration Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/sindresorhus/normalize-url/releases) - [Commits](https://github.com/sindresorhus/normalize-url/commits) --- updated-dependencies: - dependency-name: normalize-url dependency-type: indirect ... Signed-off-by: dependabot[bot] --- integration/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/package-lock.json b/integration/package-lock.json index 7a50b745f3b..d43897c3520 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -8361,9 +8361,9 @@ } }, "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", "dev": true }, "npm-path": {