From ae8064c1293a4032347807990135cd77cdc06125 Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Mon, 2 May 2022 00:58:31 +0000 Subject: [PATCH] fix #1237 remove unreachable types from generated code --- api/generate.go | 4 +- codegen/config/config.go | 8 +- codegen/config/remove_unreachable.go | 131 ++ .../followschema/builtinscalar.generated.go | 14 + .../followschema/builtinscalar.graphql | 3 + .../followschema/loops.generated.go | 7 + codegen/testserver/followschema/loops.graphql | 4 + codegen/testserver/followschema/resolver.go | 52 + .../followschema/root_.generated.go | 129 +- .../followschema/scalar_default.generated.go | 14 + .../followschema/scalar_default.graphql | 1 + .../followschema/schema.generated.go | 1027 +++++++++++- .../testserver/followschema/schema.graphql | 3 + codegen/testserver/followschema/stub.go | 52 + .../followschema/validtypes.generated.go | 7 + .../followschema/validtypes.graphql | 1 + .../weird_type_cases.generated.go | 84 + .../followschema/weird_type_cases.graphql | 9 + .../singlefile/builtinscalar.graphql | 3 + codegen/testserver/singlefile/generated.go | 1408 +++++++++++++++-- codegen/testserver/singlefile/loops.graphql | 4 + codegen/testserver/singlefile/resolver.go | 52 + .../singlefile/scalar_default.graphql | 1 + codegen/testserver/singlefile/schema.graphql | 3 + codegen/testserver/singlefile/stub.go | 52 + .../testserver/singlefile/validtypes.graphql | 1 + .../singlefile/weird_type_cases.graphql | 9 + plugin/federation/federation_test.go | 4 +- plugin/modelgen/testdata/schema.graphql | 9 + 29 files changed, 2913 insertions(+), 183 deletions(-) create mode 100644 codegen/config/remove_unreachable.go diff --git a/api/generate.go b/api/generate.go index 6619dd5cd2b..03ca05e974a 100644 --- a/api/generate.go +++ b/api/generate.go @@ -53,7 +53,7 @@ func Generate(cfg *config.Config, option ...Option) error { } } - if err := cfg.LoadSchema(); err != nil { + if err := cfg.LoadSchema(false); err != nil { return fmt.Errorf("failed to load schema: %w", err) } @@ -66,7 +66,7 @@ func Generate(cfg *config.Config, option ...Option) error { } // LoadSchema again now we have everything - if err := cfg.LoadSchema(); err != nil { + if err := cfg.LoadSchema(true); err != nil { return fmt.Errorf("failed to load schema: %w", err) } diff --git a/codegen/config/config.go b/codegen/config/config.go index 9affe6a6916..3097c6a4f9d 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -189,7 +189,7 @@ func (c *Config) Init() error { } if c.Schema == nil { - if err := c.LoadSchema(); err != nil { + if err := c.LoadSchema(true); err != nil { return err } } @@ -613,7 +613,7 @@ func (c *Config) injectBuiltins() { } } -func (c *Config) LoadSchema() error { +func (c *Config) LoadSchema(removeUnreachable bool) error { if c.Packages != nil { c.Packages = &code.Packages{} } @@ -635,6 +635,10 @@ func (c *Config) LoadSchema() error { schema.Types["Query"] = schema.Query } + if removeUnreachable { + removeUnreachableTypes(schema) + } + c.Schema = schema return nil } diff --git a/codegen/config/remove_unreachable.go b/codegen/config/remove_unreachable.go new file mode 100644 index 00000000000..6c6bec7e148 --- /dev/null +++ b/codegen/config/remove_unreachable.go @@ -0,0 +1,131 @@ +package config + +import ( + "fmt" + "sort" + "strings" + + "github.com/vektah/gqlparser/v2/ast" +) + +type reachabilityCleaner struct { + schema *ast.Schema + reachable map[string]*ast.Definition + queue []*ast.Definition +} + +func (r *reachabilityCleaner) addToQueue(def *ast.Definition) { + // simplify error handling by acceping nil and ignoring it + if def == nil { + return + } + if _, ok := r.reachable[def.Name]; !ok { + r.queue = append(r.queue, def) + } + r.reachable[def.Name] = r.schema.Types[def.Name] +} + +func (r *reachabilityCleaner) findReachableTypes() map[string]*ast.Definition { + // Mark all types reachable from the current queue of definitions as reachable + for len(r.queue) > 0 { + // pop from stack + currentType := r.queue[0] + r.queue = r.queue[1:] + + referencedFromCurrent := []*ast.Definition{} + referencedFromCurrent = append(referencedFromCurrent, r.schema.GetPossibleTypes(currentType)...) + referencedFromCurrent = append(referencedFromCurrent, r.schema.GetImplements(currentType)...) + for _, t := range currentType.Types { + referencedFromCurrent = append(referencedFromCurrent, r.schema.Types[t]) + } + for _, i := range currentType.Interfaces { + referencedFromCurrent = append(referencedFromCurrent, r.schema.Types[i]) + } + for _, f := range currentType.Fields { + referencedFromCurrent = append(referencedFromCurrent, r.schema.Types[f.Type.Name()]) + for _, arg := range f.Arguments { + referencedFromCurrent = append(referencedFromCurrent, r.schema.Types[arg.Type.Name()]) + if arg.DefaultValue != nil { + referencedFromCurrent = append(referencedFromCurrent, arg.DefaultValue.Definition) + } + } + if f.DefaultValue != nil { + referencedFromCurrent = append(referencedFromCurrent, f.DefaultValue.Definition) + } + } + for _, def := range referencedFromCurrent { + if def == nil { + continue + } + // If this type hasn't been seen before, make sure we expand it by adding to the queue + r.addToQueue(def) + // When adding a union or enum to the queue, make sure we also add all its possible implementations + for _, pt := range r.schema.PossibleTypes[def.Name] { + r.addToQueue(pt) + } + // When adding an implementation of an interface to the queue, make sure we also add the interface it implements + for _, pt := range r.schema.Implements[def.Name] { + r.addToQueue(pt) + } + } + } + + // Mark all double underscore types as reachable because they are used for introspection + for _, d := range r.schema.Types { + if strings.HasPrefix(d.Name, "__") { + r.reachable[d.Name] = d + for _, pt := range r.schema.PossibleTypes[d.Name] { + r.reachable[pt.Name] = pt + } + } + } + return r.reachable +} + +func calculateAndWarnOnUnreachableTypes(reachableTypes, allTypes map[string]*ast.Definition) { + unreachableTypes := map[string]struct{}{} + for all := range allTypes { + unreachableTypes[all] = struct{}{} + } + for r := range reachableTypes { + delete(unreachableTypes, r) + } + + if len(unreachableTypes) > 0 { + unreachableTypesList := []string{} + for t := range unreachableTypes { + unreachableTypesList = append(unreachableTypesList, t) + } + sort.Strings(unreachableTypesList) + for _, typeName := range unreachableTypesList { + if !allTypes[typeName].BuiltIn { + fmt.Printf("Warning: unreachable type: %s\n", typeName) + } + } + } +} + +func removeUnreachableTypes(a *ast.Schema) { + rc := reachabilityCleaner{ + reachable: map[string]*ast.Definition{}, + schema: a, + } + rc.addToQueue(a.Query) + rc.addToQueue(a.Mutation) + rc.addToQueue(a.Subscription) + // Entity is a fake type used in the federation plugin to generate resolver interfaces to be implemented + // TODO: find a better way to make sure it's considered reachable + rc.addToQueue(a.Types["Entity"]) + // All directive arguments are considered reachable for now. No need to clean these up as aggressively. + for _, dd := range a.Directives { + for _, arg := range dd.Arguments { + rc.addToQueue(a.Types[arg.Type.Name()]) + } + } + + reachable := rc.findReachableTypes() + + calculateAndWarnOnUnreachableTypes(reachable, a.Types) + + a.Types = reachable +} diff --git a/codegen/testserver/followschema/builtinscalar.generated.go b/codegen/testserver/followschema/builtinscalar.generated.go index b10f78eee38..f0806f4f32f 100644 --- a/codegen/testserver/followschema/builtinscalar.generated.go +++ b/codegen/testserver/followschema/builtinscalar.generated.go @@ -110,4 +110,18 @@ func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNMap2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMap(ctx context.Context, sel ast.SelectionSet, v Map) graphql.Marshaler { + return ec._Map(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMap2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMap(ctx context.Context, sel ast.SelectionSet, v *Map) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Map(ctx, sel, v) +} + // endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/followschema/builtinscalar.graphql b/codegen/testserver/followschema/builtinscalar.graphql index deb8a9f6242..2c521d8a8a3 100644 --- a/codegen/testserver/followschema/builtinscalar.graphql +++ b/codegen/testserver/followschema/builtinscalar.graphql @@ -1,3 +1,6 @@ +extend type Query { + Map: Map! +} """ Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ diff --git a/codegen/testserver/followschema/loops.generated.go b/codegen/testserver/followschema/loops.generated.go index fa3965fa275..01100336303 100644 --- a/codegen/testserver/followschema/loops.generated.go +++ b/codegen/testserver/followschema/loops.generated.go @@ -207,4 +207,11 @@ func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgen return ec._LoopB(ctx, sel, v) } +func (ec *executionContext) marshalOLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐLoopA(ctx context.Context, sel ast.SelectionSet, v *LoopA) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._LoopA(ctx, sel, v) +} + // endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/followschema/loops.graphql b/codegen/testserver/followschema/loops.graphql index 0254ef4a0e6..4e72d40e09b 100644 --- a/codegen/testserver/followschema/loops.graphql +++ b/codegen/testserver/followschema/loops.graphql @@ -1,3 +1,7 @@ +extend type Query { + LoopA: LoopA +} + type LoopA { b: LoopB! } diff --git a/codegen/testserver/followschema/resolver.go b/codegen/testserver/followschema/resolver.go index 04d4f581be7..965efd06f12 100644 --- a/codegen/testserver/followschema/resolver.go +++ b/codegen/testserver/followschema/resolver.go @@ -140,6 +140,22 @@ func (r *queryResolver) DeprecatedField(ctx context.Context) (string, error) { panic("not implemented") } +func (r *queryResolver) EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) { + panic("not implemented") +} + +func (r *queryResolver) ForcedResolver(ctx context.Context) (*ForcedResolver, error) { + panic("not implemented") +} + +func (r *queryResolver) Status(ctx context.Context) (Status, error) { + panic("not implemented") +} + +func (r *queryResolver) Map(ctx context.Context) (*Map, error) { + panic("not implemented") +} + func (r *queryResolver) Overlapping(ctx context.Context) (*OverlappingFields, error) { panic("not implemented") } @@ -236,6 +252,10 @@ func (r *queryResolver) Issue896a(ctx context.Context) ([]*CheckIssue896, error) panic("not implemented") } +func (r *queryResolver) LoopA(ctx context.Context) (*LoopA, error) { + panic("not implemented") +} + func (r *queryResolver) MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { panic("not implemented") } @@ -296,6 +316,10 @@ func (r *queryResolver) DefaultScalar(ctx context.Context, arg string) (string, panic("not implemented") } +func (r *queryResolver) EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) { + panic("not implemented") +} + func (r *queryResolver) Slices(ctx context.Context) (*Slices, error) { panic("not implemented") } @@ -324,10 +348,38 @@ func (r *queryResolver) ValidType(ctx context.Context) (*ValidType, error) { panic("not implemented") } +func (r *queryResolver) ContentChild(ctx context.Context) (ContentChild, error) { + panic("not implemented") +} + func (r *queryResolver) VariadicModel(ctx context.Context) (*VariadicModel, error) { panic("not implemented") } +func (r *queryResolver) AsdfIt(ctx context.Context) (*AsdfIt, error) { + panic("not implemented") +} + +func (r *queryResolver) AIt(ctx context.Context) (*AIt, error) { + panic("not implemented") +} + +func (r *queryResolver) IIt(ctx context.Context) (*IIt, error) { + panic("not implemented") +} + +func (r *queryResolver) XXIt(ctx context.Context) (*XXIt, error) { + panic("not implemented") +} + +func (r *queryResolver) AbIt(ctx context.Context) (*AbIt, error) { + panic("not implemented") +} + +func (r *queryResolver) XxIt(ctx context.Context) (*XxIt, error) { + panic("not implemented") +} + func (r *queryResolver) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { panic("not implemented") } diff --git a/codegen/testserver/followschema/root_.generated.go b/codegen/testserver/followschema/root_.generated.go index e1c3b6f2a61..64ac222c7aa 100644 --- a/codegen/testserver/followschema/root_.generated.go +++ b/codegen/testserver/followschema/root_.generated.go @@ -281,9 +281,13 @@ type ComplexityRoot struct { } Query struct { + AIt func(childComplexity int) int + AbIt func(childComplexity int) int Animal func(childComplexity int) int + AsdfIt func(childComplexity int) int Autobind func(childComplexity int) int Collision func(childComplexity int) int + ContentChild func(childComplexity int) int DefaultParameters func(childComplexity int, falsyBoolean *bool, truthyBoolean *bool) int DefaultScalar func(childComplexity int, arg string) int DeprecatedField func(childComplexity int) int @@ -301,17 +305,23 @@ type ComplexityRoot struct { EmbeddedCase1 func(childComplexity int) int EmbeddedCase2 func(childComplexity int) int EmbeddedCase3 func(childComplexity int) int + EmbeddedDefaultScalar func(childComplexity int) int + EmbeddedPointer func(childComplexity int) int 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 + ForcedResolver func(childComplexity int) int + IIt func(childComplexity int) int Infinity func(childComplexity int) int InputNullableSlice func(childComplexity int, arg []string) int InputSlice func(childComplexity int, arg []string) int InvalidIdentifier func(childComplexity int) int Issue896a func(childComplexity int) int + LoopA func(childComplexity int) int + Map func(childComplexity int) int MapInput func(childComplexity int, input map[string]interface{}) int MapNestedStringInterface func(childComplexity int, in *NestedMapInput) int MapStringInterface func(childComplexity int, in map[string]interface{}) int @@ -334,6 +344,7 @@ type ComplexityRoot struct { ShapeUnion func(childComplexity int) int Shapes func(childComplexity int) int Slices func(childComplexity int) int + Status func(childComplexity int) int StringFromContextFunction func(childComplexity int) int StringFromContextInterface func(childComplexity int) int User func(childComplexity int, id int) int @@ -346,6 +357,8 @@ type ComplexityRoot struct { WrappedScalar func(childComplexity int) int WrappedSlice func(childComplexity int) int WrappedStruct func(childComplexity int) int + XXIt func(childComplexity int) int + XxIt func(childComplexity int) int } Rectangle struct { @@ -1070,6 +1083,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PtrToSliceContainer.PtrToSlice(childComplexity), true + case "Query.AIt": + if e.complexity.Query.AIt == nil { + break + } + + return e.complexity.Query.AIt(childComplexity), true + + case "Query.AbIt": + if e.complexity.Query.AbIt == nil { + break + } + + return e.complexity.Query.AbIt(childComplexity), true + case "Query.animal": if e.complexity.Query.Animal == nil { break @@ -1077,6 +1104,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Animal(childComplexity), true + case "Query.asdfIt": + if e.complexity.Query.AsdfIt == nil { + break + } + + return e.complexity.Query.AsdfIt(childComplexity), true + case "Query.autobind": if e.complexity.Query.Autobind == nil { break @@ -1091,6 +1125,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Collision(childComplexity), true + case "Query.Content_Child": + if e.complexity.Query.ContentChild == nil { + break + } + + return e.complexity.Query.ContentChild(childComplexity), true + case "Query.defaultParameters": if e.complexity.Query.DefaultParameters == nil { break @@ -1250,6 +1291,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.EmbeddedCase3(childComplexity), true + case "Query.EmbeddedDefaultScalar": + if e.complexity.Query.EmbeddedDefaultScalar == nil { + break + } + + return e.complexity.Query.EmbeddedDefaultScalar(childComplexity), true + + case "Query.EmbeddedPointer": + if e.complexity.Query.EmbeddedPointer == nil { + break + } + + return e.complexity.Query.EmbeddedPointer(childComplexity), true + case "Query.enumInInput": if e.complexity.Query.EnumInInput == nil { break @@ -1302,6 +1357,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Fallback(childComplexity, args["arg"].(FallbackToStringEncoding)), true + case "Query.ForcedResolver": + if e.complexity.Query.ForcedResolver == nil { + break + } + + return e.complexity.Query.ForcedResolver(childComplexity), true + + case "Query.iIt": + if e.complexity.Query.IIt == nil { + break + } + + return e.complexity.Query.IIt(childComplexity), true + case "Query.infinity": if e.complexity.Query.Infinity == nil { break @@ -1347,6 +1416,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Issue896a(childComplexity), true + case "Query.LoopA": + if e.complexity.Query.LoopA == nil { + break + } + + return e.complexity.Query.LoopA(childComplexity), true + + case "Query.Map": + if e.complexity.Query.Map == nil { + break + } + + return e.complexity.Query.Map(childComplexity), true + case "Query.mapInput": if e.complexity.Query.MapInput == nil { break @@ -1531,6 +1614,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Slices(childComplexity), true + case "Query.Status": + if e.complexity.Query.Status == nil { + break + } + + return e.complexity.Query.Status(childComplexity), true + case "Query.stringFromContextFunction": if e.complexity.Query.StringFromContextFunction == nil { break @@ -1620,6 +1710,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.WrappedStruct(childComplexity), true + case "Query.XXIt": + if e.complexity.Query.XXIt == nil { + break + } + + return e.complexity.Query.XXIt(childComplexity), true + + case "Query.XxIt": + if e.complexity.Query.XxIt == nil { + break + } + + return e.complexity.Query.XxIt(childComplexity), true + case "Rectangle.area": if e.complexity.Rectangle.Area == nil { break @@ -2010,7 +2114,10 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "builtinscalar.graphql", Input: ` + {Name: "builtinscalar.graphql", Input: `extend type Query { + Map: Map! +} + """ Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ added to the TypeMap @@ -2228,7 +2335,11 @@ extend type Subscription { issue896b: [CheckIssue896] # Note the "!" or lack thereof. } `, BuiltIn: false}, - {Name: "loops.graphql", Input: `type LoopA { + {Name: "loops.graphql", Input: `extend type Query { + LoopA: LoopA +} + +type LoopA { b: LoopB! } @@ -2370,6 +2481,7 @@ scalar StringFromContextFunction `, BuiltIn: false}, {Name: "scalar_default.graphql", Input: `extend type Query { defaultScalar(arg: DefaultScalarImplementation! = "default"): DefaultScalarImplementation! + EmbeddedDefaultScalar: EmbeddedDefaultScalar! } """ This doesnt have an implementation in the typemap, so it should act like a string """ @@ -2403,6 +2515,9 @@ type Query { shapeUnion: ShapeUnion! autobind: Autobind deprecatedField: String! @deprecated(reason: "test deprecated directive") + EmbeddedPointer: EmbeddedPointer! + ForcedResolver: ForcedResolver! + Status: Status! } type Subscription { @@ -2544,6 +2659,7 @@ type VOkCaseNil @goModel(model:"followschema.VOkCaseNil") { `, BuiltIn: false}, {Name: "validtypes.graphql", Input: `extend type Query { validType: ValidType + Content_Child: Content_Child } """ These things are all valid, but without care generate invalid go code """ @@ -2631,6 +2747,15 @@ type VariadicModel { `, BuiltIn: false}, {Name: "weird_type_cases.graphql", Input: `# regression test for https://github.com/99designs/gqlgen/issues/583 +extend type Query { + asdfIt: asdfIt! + AIt: AIt! + iIt: iIt! + XXIt: XXIt! + AbIt: AbIt! + XxIt: XxIt! +} + type asdfIt { id: ID! } type iIt { id: ID! } type AIt { id: ID! } diff --git a/codegen/testserver/followschema/scalar_default.generated.go b/codegen/testserver/followschema/scalar_default.generated.go index 1e2362c914c..f1c0ff35770 100644 --- a/codegen/testserver/followschema/scalar_default.generated.go +++ b/codegen/testserver/followschema/scalar_default.generated.go @@ -119,6 +119,20 @@ func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx conte return res } +func (ec *executionContext) marshalNEmbeddedDefaultScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedDefaultScalar(ctx context.Context, sel ast.SelectionSet, v EmbeddedDefaultScalar) graphql.Marshaler { + return ec._EmbeddedDefaultScalar(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEmbeddedDefaultScalar2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedDefaultScalar(ctx context.Context, sel ast.SelectionSet, v *EmbeddedDefaultScalar) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._EmbeddedDefaultScalar(ctx, sel, v) +} + func (ec *executionContext) unmarshalODefaultScalarImplementation2ᚖstring(ctx context.Context, v interface{}) (*string, error) { if v == nil { return nil, nil diff --git a/codegen/testserver/followschema/scalar_default.graphql b/codegen/testserver/followschema/scalar_default.graphql index 5e3a9c08fd1..eaf56b0e5c5 100644 --- a/codegen/testserver/followschema/scalar_default.graphql +++ b/codegen/testserver/followschema/scalar_default.graphql @@ -1,5 +1,6 @@ extend type Query { defaultScalar(arg: DefaultScalarImplementation! = "default"): DefaultScalarImplementation! + EmbeddedDefaultScalar: EmbeddedDefaultScalar! } """ This doesnt have an implementation in the typemap, so it should act like a string """ diff --git a/codegen/testserver/followschema/schema.generated.go b/codegen/testserver/followschema/schema.generated.go index bb8b19614a6..4e2145fb0d7 100644 --- a/codegen/testserver/followschema/schema.generated.go +++ b/codegen/testserver/followschema/schema.generated.go @@ -46,6 +46,10 @@ type QueryResolver interface { ShapeUnion(ctx context.Context) (ShapeUnion, error) Autobind(ctx context.Context) (*Autobind, error) DeprecatedField(ctx context.Context) (string, error) + EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) + ForcedResolver(ctx context.Context) (*ForcedResolver, error) + Status(ctx context.Context) (Status, error) + Map(ctx context.Context) (*Map, error) Overlapping(ctx context.Context) (*OverlappingFields, error) DefaultParameters(ctx context.Context, falsyBoolean *bool, truthyBoolean *bool) (*DefaultParametersMirror, error) DirectiveArg(ctx context.Context, arg string) (*string, error) @@ -70,6 +74,7 @@ type QueryResolver interface { Animal(ctx context.Context) (Animal, error) NotAnInterface(ctx context.Context) (BackedByInterface, error) Issue896a(ctx context.Context) ([]*CheckIssue896, error) + LoopA(ctx context.Context) (*LoopA, error) 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) @@ -85,6 +90,7 @@ type QueryResolver interface { StringFromContextInterface(ctx context.Context) (*StringFromContextInterface, error) StringFromContextFunction(ctx context.Context) (string, error) DefaultScalar(ctx context.Context, arg string) (string, error) + EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) Slices(ctx context.Context) (*Slices, error) ScalarSlice(ctx context.Context) ([]byte, error) Fallback(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) @@ -92,7 +98,14 @@ type QueryResolver interface { VOkCaseValue(ctx context.Context) (*VOkCaseValue, error) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) ValidType(ctx context.Context) (*ValidType, error) + ContentChild(ctx context.Context) (ContentChild, error) VariadicModel(ctx context.Context) (*VariadicModel, error) + AsdfIt(ctx context.Context) (*AsdfIt, error) + AIt(ctx context.Context) (*AIt, error) + IIt(ctx context.Context) (*IIt, error) + XXIt(ctx context.Context) (*XXIt, error) + AbIt(ctx context.Context) (*AbIt, error) + XxIt(ctx context.Context) (*XxIt, error) WrappedStruct(ctx context.Context) (*WrappedStruct, error) WrappedScalar(ctx context.Context) (otherpkg.Scalar, error) WrappedMap(ctx context.Context) (WrappedMap, error) @@ -2084,6 +2097,184 @@ func (ec *executionContext) fieldContext_Query_deprecatedField(ctx context.Conte return fc, nil } +func (ec *executionContext) _Query_EmbeddedPointer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_EmbeddedPointer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().EmbeddedPointer(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*EmbeddedPointerModel) + fc.Result = res + return ec.marshalNEmbeddedPointer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedPointerModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_EmbeddedPointer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "ID": + return ec.fieldContext_EmbeddedPointer_ID(ctx, field) + case "Title": + return ec.fieldContext_EmbeddedPointer_Title(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmbeddedPointer", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_ForcedResolver(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_ForcedResolver(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ForcedResolver(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*ForcedResolver) + fc.Result = res + return ec.marshalNForcedResolver2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐForcedResolver(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_ForcedResolver(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "field": + return ec.fieldContext_ForcedResolver_field(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ForcedResolver", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_Status(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Status(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Status(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(Status) + fc.Result = res + return ec.marshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_Status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Status does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_Map(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Map(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Map(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Map) + fc.Result = res + return ec.marshalNMap2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMap(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_Map(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Map_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Map", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_overlapping(ctx, field) if err != nil { @@ -3338,6 +3529,48 @@ func (ec *executionContext) fieldContext_Query_issue896a(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _Query_LoopA(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_LoopA(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().LoopA(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*LoopA) + fc.Result = res + return ec.marshalOLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐLoopA(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_LoopA(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "b": + return ec.fieldContext_LoopA_b(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LoopA", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_mapStringInterface(ctx, field) if err != nil { @@ -4045,6 +4278,51 @@ func (ec *executionContext) fieldContext_Query_defaultScalar(ctx context.Context return fc, nil } +func (ec *executionContext) _Query_EmbeddedDefaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_EmbeddedDefaultScalar(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().EmbeddedDefaultScalar(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*EmbeddedDefaultScalar) + fc.Result = res + return ec.marshalNEmbeddedDefaultScalar2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedDefaultScalar(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_EmbeddedDefaultScalar(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "value": + return ec.fieldContext_EmbeddedDefaultScalar_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmbeddedDefaultScalar", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_slices(ctx, field) if err != nil { @@ -4356,8 +4634,8 @@ func (ec *executionContext) fieldContext_Query_validType(ctx context.Context, fi return fc, nil } -func (ec *executionContext) _Query_variadicModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_variadicModel(ctx, field) +func (ec *executionContext) _Query_Content_Child(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Content_Child(ctx, field) if err != nil { return graphql.Null } @@ -4370,36 +4648,32 @@ func (ec *executionContext) _Query_variadicModel(ctx context.Context, field grap }() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().VariadicModel(rctx) + return ec.resolvers.Query().ContentChild(rctx) }) if resTmp == nil { return graphql.Null } - res := resTmp.(*VariadicModel) + res := resTmp.(ContentChild) fc.Result = res - return ec.marshalOVariadicModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐVariadicModel(ctx, field.Selections, res) + return ec.marshalOContent_Child2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐContentChild(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_variadicModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_Content_Child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "value": - return ec.fieldContext_VariadicModel_value(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type VariadicModel", field.Name) + return nil, errors.New("field of type Content_Child does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_wrappedStruct(ctx, field) +func (ec *executionContext) _Query_variadicModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_variadicModel(ctx, field) if err != nil { return graphql.Null } @@ -4412,21 +4686,18 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap }() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().WrappedStruct(rctx) + return ec.resolvers.Query().VariadicModel(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*WrappedStruct) + res := resTmp.(*VariadicModel) fc.Result = res - return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐWrappedStruct(ctx, field.Selections, res) + return ec.marshalOVariadicModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐVariadicModel(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_variadicModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -4434,19 +4705,17 @@ func (ec *executionContext) fieldContext_Query_wrappedStruct(ctx context.Context IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext_WrappedStruct_name(ctx, field) - case "desc": - return ec.fieldContext_WrappedStruct_desc(ctx, field) + case "value": + return ec.fieldContext_VariadicModel_value(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type WrappedStruct", field.Name) + return nil, fmt.Errorf("no field named %q was found under type VariadicModel", field.Name) }, } return fc, nil } -func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_wrappedScalar(ctx, field) +func (ec *executionContext) _Query_asdfIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_asdfIt(ctx, field) if err != nil { return graphql.Null } @@ -4459,7 +4728,7 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap }() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().WrappedScalar(rctx) + return ec.resolvers.Query().AsdfIt(rctx) }) if resTmp == nil { @@ -4468,20 +4737,337 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(otherpkg.Scalar) + res := resTmp.(*AsdfIt) fc.Result = res - return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚋotherpkgᚐScalar(ctx, field.Selections, res) + return ec.marshalNasdfIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAsdfIt(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_asdfIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type WrappedScalar does not have child fields") - }, + switch field.Name { + case "id": + return ec.fieldContext_asdfIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type asdfIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_AIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_AIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*AIt) + fc.Result = res + return ec.marshalNAIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_AIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_AIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_iIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_iIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().IIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*IIt) + fc.Result = res + return ec.marshalNiIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐIIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_iIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_iIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type iIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_XXIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_XXIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().XXIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*XXIt) + fc.Result = res + return ec.marshalNXXIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXXIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_XXIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_XXIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type XXIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_AbIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_AbIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AbIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*AbIt) + fc.Result = res + return ec.marshalNAbIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAbIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_AbIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_AbIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AbIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_XxIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_XxIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().XxIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*XxIt) + fc.Result = res + return ec.marshalNXxIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXxIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_XxIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_XxIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type XxIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_wrappedStruct(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().WrappedStruct(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*WrappedStruct) + fc.Result = res + return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐWrappedStruct(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_WrappedStruct_name(ctx, field) + case "desc": + return ec.fieldContext_WrappedStruct_desc(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type WrappedStruct", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_wrappedScalar(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().WrappedScalar(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(otherpkg.Scalar) + fc.Result = res + return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚋotherpkgᚐScalar(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type WrappedScalar does not have child fields") + }, } return fc, nil } @@ -5910,7 +6496,87 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "recursive": + case "recursive": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_recursive(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "nestedInputs": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_nestedInputs(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "nestedOutputs": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_nestedOutputs(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "modelMethods": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_modelMethods(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "user": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -5919,7 +6585,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_recursive(ctx, field) + res = ec._Query_user(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -5930,7 +6599,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nestedInputs": + case "nullableArg": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -5939,7 +6608,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nestedInputs(ctx, field) + res = ec._Query_nullableArg(ctx, field) return res } @@ -5950,7 +6619,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nestedOutputs": + case "inputSlice": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -5959,7 +6628,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nestedOutputs(ctx, field) + res = ec._Query_inputSlice(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -5970,7 +6642,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "modelMethods": + case "inputNullableSlice": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -5979,7 +6651,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_modelMethods(ctx, field) + res = ec._Query_inputNullableSlice(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -5990,7 +6665,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "user": + case "shapeUnion": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -5999,7 +6674,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_user(ctx, field) + res = ec._Query_shapeUnion(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -6013,7 +6688,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nullableArg": + case "autobind": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6022,7 +6697,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nullableArg(ctx, field) + res = ec._Query_autobind(ctx, field) return res } @@ -6033,7 +6708,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "inputSlice": + case "deprecatedField": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6042,7 +6717,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_inputSlice(ctx, field) + res = ec._Query_deprecatedField(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -6056,7 +6731,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "inputNullableSlice": + case "EmbeddedPointer": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6065,7 +6740,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_inputNullableSlice(ctx, field) + res = ec._Query_EmbeddedPointer(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -6079,7 +6754,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "shapeUnion": + case "ForcedResolver": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6088,7 +6763,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_shapeUnion(ctx, field) + res = ec._Query_ForcedResolver(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -6102,7 +6777,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "autobind": + case "Status": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6111,7 +6786,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_autobind(ctx, field) + res = ec._Query_Status(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -6122,7 +6800,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "deprecatedField": + case "Map": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -6131,7 +6809,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_deprecatedField(ctx, field) + res = ec._Query_Map(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -6634,6 +7312,26 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) } + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "LoopA": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_LoopA(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) @@ -6958,6 +7656,29 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) } + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "EmbeddedDefaultScalar": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_EmbeddedDefaultScalar(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) @@ -7104,6 +7825,26 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) } + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "Content_Child": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_Content_Child(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) @@ -7124,6 +7865,144 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) } + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "asdfIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_asdfIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "AIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_AIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "iIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_iIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "XXIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_XXIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "AbIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_AbIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "XxIt": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_XxIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) @@ -7356,6 +8235,34 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNEmbeddedPointer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedPointerModel(ctx context.Context, sel ast.SelectionSet, v EmbeddedPointerModel) graphql.Marshaler { + return ec._EmbeddedPointer(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEmbeddedPointer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedPointerModel(ctx context.Context, sel ast.SelectionSet, v *EmbeddedPointerModel) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._EmbeddedPointer(ctx, sel, v) +} + +func (ec *executionContext) marshalNForcedResolver2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐForcedResolver(ctx context.Context, sel ast.SelectionSet, v ForcedResolver) graphql.Marshaler { + return ec._ForcedResolver(ctx, sel, &v) +} + +func (ec *executionContext) marshalNForcedResolver2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐForcedResolver(ctx context.Context, sel ast.SelectionSet, v *ForcedResolver) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ForcedResolver(ctx, sel, v) +} + func (ec *executionContext) unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerInput(ctx context.Context, v interface{}) (InnerInput, error) { res, err := ec.unmarshalInputInnerInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -7391,6 +8298,16 @@ func (ec *executionContext) unmarshalNRecursiveInputSlice2githubᚗcomᚋ99desig return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐStatus(ctx context.Context, v interface{}) (Status, error) { + var res Status + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐStatus(ctx context.Context, sel ast.SelectionSet, v Status) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { res, err := graphql.UnmarshalTime(v) return res, graphql.ErrorOnPath(ctx, err) diff --git a/codegen/testserver/followschema/schema.graphql b/codegen/testserver/followschema/schema.graphql index 091d11558e9..dbc3ee6a67c 100644 --- a/codegen/testserver/followschema/schema.graphql +++ b/codegen/testserver/followschema/schema.graphql @@ -22,6 +22,9 @@ type Query { shapeUnion: ShapeUnion! autobind: Autobind deprecatedField: String! @deprecated(reason: "test deprecated directive") + EmbeddedPointer: EmbeddedPointer! + ForcedResolver: ForcedResolver! + Status: Status! } type Subscription { diff --git a/codegen/testserver/followschema/stub.go b/codegen/testserver/followschema/stub.go index a1bb8859ff4..46dac0c9848 100644 --- a/codegen/testserver/followschema/stub.go +++ b/codegen/testserver/followschema/stub.go @@ -64,6 +64,10 @@ type Stub struct { ShapeUnion func(ctx context.Context) (ShapeUnion, error) Autobind func(ctx context.Context) (*Autobind, error) DeprecatedField func(ctx context.Context) (string, error) + EmbeddedPointer func(ctx context.Context) (*EmbeddedPointerModel, error) + ForcedResolver func(ctx context.Context) (*ForcedResolver, error) + Status func(ctx context.Context) (Status, error) + Map func(ctx context.Context) (*Map, error) Overlapping func(ctx context.Context) (*OverlappingFields, error) DefaultParameters func(ctx context.Context, falsyBoolean *bool, truthyBoolean *bool) (*DefaultParametersMirror, error) DirectiveArg func(ctx context.Context, arg string) (*string, error) @@ -88,6 +92,7 @@ type Stub struct { Animal func(ctx context.Context) (Animal, error) NotAnInterface func(ctx context.Context) (BackedByInterface, error) Issue896a func(ctx context.Context) ([]*CheckIssue896, error) + LoopA func(ctx context.Context) (*LoopA, error) 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) @@ -103,6 +108,7 @@ type Stub struct { StringFromContextInterface func(ctx context.Context) (*StringFromContextInterface, error) StringFromContextFunction func(ctx context.Context) (string, error) DefaultScalar func(ctx context.Context, arg string) (string, error) + EmbeddedDefaultScalar func(ctx context.Context) (*EmbeddedDefaultScalar, error) Slices func(ctx context.Context) (*Slices, error) ScalarSlice func(ctx context.Context) ([]byte, error) Fallback func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) @@ -110,7 +116,14 @@ type Stub struct { VOkCaseValue func(ctx context.Context) (*VOkCaseValue, error) VOkCaseNil func(ctx context.Context) (*VOkCaseNil, error) ValidType func(ctx context.Context) (*ValidType, error) + ContentChild func(ctx context.Context) (ContentChild, error) VariadicModel func(ctx context.Context) (*VariadicModel, error) + AsdfIt func(ctx context.Context) (*AsdfIt, error) + AIt func(ctx context.Context) (*AIt, error) + IIt func(ctx context.Context) (*IIt, error) + XXIt func(ctx context.Context) (*XXIt, error) + AbIt func(ctx context.Context) (*AbIt, error) + XxIt func(ctx context.Context) (*XxIt, error) WrappedStruct func(ctx context.Context) (*WrappedStruct, error) WrappedScalar func(ctx context.Context) (otherpkg.Scalar, error) WrappedMap func(ctx context.Context) (WrappedMap, error) @@ -312,6 +325,18 @@ func (r *stubQuery) Autobind(ctx context.Context) (*Autobind, error) { func (r *stubQuery) DeprecatedField(ctx context.Context) (string, error) { return r.QueryResolver.DeprecatedField(ctx) } +func (r *stubQuery) EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) { + return r.QueryResolver.EmbeddedPointer(ctx) +} +func (r *stubQuery) ForcedResolver(ctx context.Context) (*ForcedResolver, error) { + return r.QueryResolver.ForcedResolver(ctx) +} +func (r *stubQuery) Status(ctx context.Context) (Status, error) { + return r.QueryResolver.Status(ctx) +} +func (r *stubQuery) Map(ctx context.Context) (*Map, error) { + return r.QueryResolver.Map(ctx) +} func (r *stubQuery) Overlapping(ctx context.Context) (*OverlappingFields, error) { return r.QueryResolver.Overlapping(ctx) } @@ -384,6 +409,9 @@ func (r *stubQuery) NotAnInterface(ctx context.Context) (BackedByInterface, erro func (r *stubQuery) Issue896a(ctx context.Context) ([]*CheckIssue896, error) { return r.QueryResolver.Issue896a(ctx) } +func (r *stubQuery) LoopA(ctx context.Context) (*LoopA, error) { + return r.QueryResolver.LoopA(ctx) +} func (r *stubQuery) MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { return r.QueryResolver.MapStringInterface(ctx, in) } @@ -429,6 +457,9 @@ func (r *stubQuery) StringFromContextFunction(ctx context.Context) (string, erro func (r *stubQuery) DefaultScalar(ctx context.Context, arg string) (string, error) { return r.QueryResolver.DefaultScalar(ctx, arg) } +func (r *stubQuery) EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) { + return r.QueryResolver.EmbeddedDefaultScalar(ctx) +} func (r *stubQuery) Slices(ctx context.Context) (*Slices, error) { return r.QueryResolver.Slices(ctx) } @@ -450,9 +481,30 @@ func (r *stubQuery) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) { func (r *stubQuery) ValidType(ctx context.Context) (*ValidType, error) { return r.QueryResolver.ValidType(ctx) } +func (r *stubQuery) ContentChild(ctx context.Context) (ContentChild, error) { + return r.QueryResolver.ContentChild(ctx) +} func (r *stubQuery) VariadicModel(ctx context.Context) (*VariadicModel, error) { return r.QueryResolver.VariadicModel(ctx) } +func (r *stubQuery) AsdfIt(ctx context.Context) (*AsdfIt, error) { + return r.QueryResolver.AsdfIt(ctx) +} +func (r *stubQuery) AIt(ctx context.Context) (*AIt, error) { + return r.QueryResolver.AIt(ctx) +} +func (r *stubQuery) IIt(ctx context.Context) (*IIt, error) { + return r.QueryResolver.IIt(ctx) +} +func (r *stubQuery) XXIt(ctx context.Context) (*XXIt, error) { + return r.QueryResolver.XXIt(ctx) +} +func (r *stubQuery) AbIt(ctx context.Context) (*AbIt, error) { + return r.QueryResolver.AbIt(ctx) +} +func (r *stubQuery) XxIt(ctx context.Context) (*XxIt, error) { + return r.QueryResolver.XxIt(ctx) +} func (r *stubQuery) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { return r.QueryResolver.WrappedStruct(ctx) } diff --git a/codegen/testserver/followschema/validtypes.generated.go b/codegen/testserver/followschema/validtypes.generated.go index c575470086f..64738566627 100644 --- a/codegen/testserver/followschema/validtypes.generated.go +++ b/codegen/testserver/followschema/validtypes.generated.go @@ -904,6 +904,13 @@ func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalOContent_Child2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐContentChild(ctx context.Context, sel ast.SelectionSet, v ContentChild) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Content_Child(ctx, sel, v) +} + func (ec *executionContext) unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidInput(ctx context.Context, v interface{}) (*ValidInput, error) { if v == nil { return nil, nil diff --git a/codegen/testserver/followschema/validtypes.graphql b/codegen/testserver/followschema/validtypes.graphql index 9912e9a9515..7d53ab4c543 100644 --- a/codegen/testserver/followschema/validtypes.graphql +++ b/codegen/testserver/followschema/validtypes.graphql @@ -1,5 +1,6 @@ extend type Query { validType: ValidType + Content_Child: Content_Child } """ These things are all valid, but without care generate invalid go code """ diff --git a/codegen/testserver/followschema/weird_type_cases.generated.go b/codegen/testserver/followschema/weird_type_cases.generated.go index f4c5ef9a6d1..1e85a1ecff1 100644 --- a/codegen/testserver/followschema/weird_type_cases.generated.go +++ b/codegen/testserver/followschema/weird_type_cases.generated.go @@ -455,4 +455,88 @@ func (ec *executionContext) _iIt(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNAIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAIt(ctx context.Context, sel ast.SelectionSet, v AIt) graphql.Marshaler { + return ec._AIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAIt(ctx context.Context, sel ast.SelectionSet, v *AIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNAbIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAbIt(ctx context.Context, sel ast.SelectionSet, v AbIt) graphql.Marshaler { + return ec._AbIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAbIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAbIt(ctx context.Context, sel ast.SelectionSet, v *AbIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AbIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNXXIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXXIt(ctx context.Context, sel ast.SelectionSet, v XXIt) graphql.Marshaler { + return ec._XXIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNXXIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXXIt(ctx context.Context, sel ast.SelectionSet, v *XXIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._XXIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNXxIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXxIt(ctx context.Context, sel ast.SelectionSet, v XxIt) graphql.Marshaler { + return ec._XxIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNXxIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐXxIt(ctx context.Context, sel ast.SelectionSet, v *XxIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._XxIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNasdfIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAsdfIt(ctx context.Context, sel ast.SelectionSet, v AsdfIt) graphql.Marshaler { + return ec._asdfIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNasdfIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAsdfIt(ctx context.Context, sel ast.SelectionSet, v *AsdfIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._asdfIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNiIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐIIt(ctx context.Context, sel ast.SelectionSet, v IIt) graphql.Marshaler { + return ec._iIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNiIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐIIt(ctx context.Context, sel ast.SelectionSet, v *IIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._iIt(ctx, sel, v) +} + // endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/followschema/weird_type_cases.graphql b/codegen/testserver/followschema/weird_type_cases.graphql index afd440f1d12..cce83f20dea 100644 --- a/codegen/testserver/followschema/weird_type_cases.graphql +++ b/codegen/testserver/followschema/weird_type_cases.graphql @@ -1,5 +1,14 @@ # regression test for https://github.com/99designs/gqlgen/issues/583 +extend type Query { + asdfIt: asdfIt! + AIt: AIt! + iIt: iIt! + XXIt: XXIt! + AbIt: AbIt! + XxIt: XxIt! +} + type asdfIt { id: ID! } type iIt { id: ID! } type AIt { id: ID! } diff --git a/codegen/testserver/singlefile/builtinscalar.graphql b/codegen/testserver/singlefile/builtinscalar.graphql index deb8a9f6242..2c521d8a8a3 100644 --- a/codegen/testserver/singlefile/builtinscalar.graphql +++ b/codegen/testserver/singlefile/builtinscalar.graphql @@ -1,3 +1,6 @@ +extend type Query { + Map: Map! +} """ Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index a573d7e097f..80480fc7d9c 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -292,9 +292,13 @@ type ComplexityRoot struct { } Query struct { + AIt func(childComplexity int) int + AbIt func(childComplexity int) int Animal func(childComplexity int) int + AsdfIt func(childComplexity int) int Autobind func(childComplexity int) int Collision func(childComplexity int) int + ContentChild func(childComplexity int) int DefaultParameters func(childComplexity int, falsyBoolean *bool, truthyBoolean *bool) int DefaultScalar func(childComplexity int, arg string) int DeprecatedField func(childComplexity int) int @@ -312,17 +316,23 @@ type ComplexityRoot struct { EmbeddedCase1 func(childComplexity int) int EmbeddedCase2 func(childComplexity int) int EmbeddedCase3 func(childComplexity int) int + EmbeddedDefaultScalar func(childComplexity int) int + EmbeddedPointer func(childComplexity int) int 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 + ForcedResolver func(childComplexity int) int + IIt func(childComplexity int) int Infinity func(childComplexity int) int InputNullableSlice func(childComplexity int, arg []string) int InputSlice func(childComplexity int, arg []string) int InvalidIdentifier func(childComplexity int) int Issue896a func(childComplexity int) int + LoopA func(childComplexity int) int + Map func(childComplexity int) int MapInput func(childComplexity int, input map[string]interface{}) int MapNestedStringInterface func(childComplexity int, in *NestedMapInput) int MapStringInterface func(childComplexity int, in map[string]interface{}) int @@ -345,6 +355,7 @@ type ComplexityRoot struct { ShapeUnion func(childComplexity int) int Shapes func(childComplexity int) int Slices func(childComplexity int) int + Status func(childComplexity int) int StringFromContextFunction func(childComplexity int) int StringFromContextInterface func(childComplexity int) int User func(childComplexity int, id int) int @@ -357,6 +368,8 @@ type ComplexityRoot struct { WrappedScalar func(childComplexity int) int WrappedSlice func(childComplexity int) int WrappedStruct func(childComplexity int) int + XXIt func(childComplexity int) int + XxIt func(childComplexity int) int } Rectangle struct { @@ -496,6 +509,10 @@ type QueryResolver interface { ShapeUnion(ctx context.Context) (ShapeUnion, error) Autobind(ctx context.Context) (*Autobind, error) DeprecatedField(ctx context.Context) (string, error) + EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) + ForcedResolver(ctx context.Context) (*ForcedResolver, error) + Status(ctx context.Context) (Status, error) + Map(ctx context.Context) (*Map, error) Overlapping(ctx context.Context) (*OverlappingFields, error) DefaultParameters(ctx context.Context, falsyBoolean *bool, truthyBoolean *bool) (*DefaultParametersMirror, error) DirectiveArg(ctx context.Context, arg string) (*string, error) @@ -520,6 +537,7 @@ type QueryResolver interface { Animal(ctx context.Context) (Animal, error) NotAnInterface(ctx context.Context) (BackedByInterface, error) Issue896a(ctx context.Context) ([]*CheckIssue896, error) + LoopA(ctx context.Context) (*LoopA, error) 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) @@ -535,6 +553,7 @@ type QueryResolver interface { StringFromContextInterface(ctx context.Context) (*StringFromContextInterface, error) StringFromContextFunction(ctx context.Context) (string, error) DefaultScalar(ctx context.Context, arg string) (string, error) + EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) Slices(ctx context.Context) (*Slices, error) ScalarSlice(ctx context.Context) ([]byte, error) Fallback(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) @@ -542,7 +561,14 @@ type QueryResolver interface { VOkCaseValue(ctx context.Context) (*VOkCaseValue, error) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) ValidType(ctx context.Context) (*ValidType, error) + ContentChild(ctx context.Context) (ContentChild, error) VariadicModel(ctx context.Context) (*VariadicModel, error) + AsdfIt(ctx context.Context) (*AsdfIt, error) + AIt(ctx context.Context) (*AIt, error) + IIt(ctx context.Context) (*IIt, error) + XXIt(ctx context.Context) (*XXIt, error) + AbIt(ctx context.Context) (*AbIt, error) + XxIt(ctx context.Context) (*XxIt, error) WrappedStruct(ctx context.Context) (*WrappedStruct, error) WrappedScalar(ctx context.Context) (otherpkg.Scalar, error) WrappedMap(ctx context.Context) (WrappedMap, error) @@ -1210,6 +1236,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PtrToSliceContainer.PtrToSlice(childComplexity), true + case "Query.AIt": + if e.complexity.Query.AIt == nil { + break + } + + return e.complexity.Query.AIt(childComplexity), true + + case "Query.AbIt": + if e.complexity.Query.AbIt == nil { + break + } + + return e.complexity.Query.AbIt(childComplexity), true + case "Query.animal": if e.complexity.Query.Animal == nil { break @@ -1217,6 +1257,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Animal(childComplexity), true + case "Query.asdfIt": + if e.complexity.Query.AsdfIt == nil { + break + } + + return e.complexity.Query.AsdfIt(childComplexity), true + case "Query.autobind": if e.complexity.Query.Autobind == nil { break @@ -1231,6 +1278,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Collision(childComplexity), true + case "Query.Content_Child": + if e.complexity.Query.ContentChild == nil { + break + } + + return e.complexity.Query.ContentChild(childComplexity), true + case "Query.defaultParameters": if e.complexity.Query.DefaultParameters == nil { break @@ -1390,6 +1444,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.EmbeddedCase3(childComplexity), true + case "Query.EmbeddedDefaultScalar": + if e.complexity.Query.EmbeddedDefaultScalar == nil { + break + } + + return e.complexity.Query.EmbeddedDefaultScalar(childComplexity), true + + case "Query.EmbeddedPointer": + if e.complexity.Query.EmbeddedPointer == nil { + break + } + + return e.complexity.Query.EmbeddedPointer(childComplexity), true + case "Query.enumInInput": if e.complexity.Query.EnumInInput == nil { break @@ -1442,6 +1510,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Fallback(childComplexity, args["arg"].(FallbackToStringEncoding)), true + case "Query.ForcedResolver": + if e.complexity.Query.ForcedResolver == nil { + break + } + + return e.complexity.Query.ForcedResolver(childComplexity), true + + case "Query.iIt": + if e.complexity.Query.IIt == nil { + break + } + + return e.complexity.Query.IIt(childComplexity), true + case "Query.infinity": if e.complexity.Query.Infinity == nil { break @@ -1487,6 +1569,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Issue896a(childComplexity), true + case "Query.LoopA": + if e.complexity.Query.LoopA == nil { + break + } + + return e.complexity.Query.LoopA(childComplexity), true + + case "Query.Map": + if e.complexity.Query.Map == nil { + break + } + + return e.complexity.Query.Map(childComplexity), true + case "Query.mapInput": if e.complexity.Query.MapInput == nil { break @@ -1671,6 +1767,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Slices(childComplexity), true + case "Query.Status": + if e.complexity.Query.Status == nil { + break + } + + return e.complexity.Query.Status(childComplexity), true + case "Query.stringFromContextFunction": if e.complexity.Query.StringFromContextFunction == nil { break @@ -1760,6 +1863,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.WrappedStruct(childComplexity), true + case "Query.XXIt": + if e.complexity.Query.XXIt == nil { + break + } + + return e.complexity.Query.XXIt(childComplexity), true + + case "Query.XxIt": + if e.complexity.Query.XxIt == nil { + break + } + + return e.complexity.Query.XxIt(childComplexity), true + case "Rectangle.area": if e.complexity.Rectangle.Area == nil { break @@ -2150,7 +2267,10 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "builtinscalar.graphql", Input: ` + {Name: "builtinscalar.graphql", Input: `extend type Query { + Map: Map! +} + """ Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ added to the TypeMap @@ -2368,7 +2488,11 @@ extend type Subscription { issue896b: [CheckIssue896] # Note the "!" or lack thereof. } `, BuiltIn: false}, - {Name: "loops.graphql", Input: `type LoopA { + {Name: "loops.graphql", Input: `extend type Query { + LoopA: LoopA +} + +type LoopA { b: LoopB! } @@ -2510,6 +2634,7 @@ scalar StringFromContextFunction `, BuiltIn: false}, {Name: "scalar_default.graphql", Input: `extend type Query { defaultScalar(arg: DefaultScalarImplementation! = "default"): DefaultScalarImplementation! + EmbeddedDefaultScalar: EmbeddedDefaultScalar! } """ This doesnt have an implementation in the typemap, so it should act like a string """ @@ -2543,6 +2668,9 @@ type Query { shapeUnion: ShapeUnion! autobind: Autobind deprecatedField: String! @deprecated(reason: "test deprecated directive") + EmbeddedPointer: EmbeddedPointer! + ForcedResolver: ForcedResolver! + Status: Status! } type Subscription { @@ -2684,6 +2812,7 @@ type VOkCaseNil @goModel(model:"singlefile.VOkCaseNil") { `, BuiltIn: false}, {Name: "validtypes.graphql", Input: `extend type Query { validType: ValidType + Content_Child: Content_Child } """ These things are all valid, but without care generate invalid go code """ @@ -2771,6 +2900,15 @@ type VariadicModel { `, BuiltIn: false}, {Name: "weird_type_cases.graphql", Input: `# regression test for https://github.com/99designs/gqlgen/issues/583 +extend type Query { + asdfIt: asdfIt! + AIt: AIt! + iIt: iIt! + XXIt: XXIt! + AbIt: AbIt! + XxIt: XxIt! +} + type asdfIt { id: ID! } type iIt { id: ID! } type AIt { id: ID! } @@ -8354,6 +8492,184 @@ func (ec *executionContext) fieldContext_Query_deprecatedField(ctx context.Conte return fc, nil } +func (ec *executionContext) _Query_EmbeddedPointer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_EmbeddedPointer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().EmbeddedPointer(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*EmbeddedPointerModel) + fc.Result = res + return ec.marshalNEmbeddedPointer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedPointerModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_EmbeddedPointer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "ID": + return ec.fieldContext_EmbeddedPointer_ID(ctx, field) + case "Title": + return ec.fieldContext_EmbeddedPointer_Title(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmbeddedPointer", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_ForcedResolver(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_ForcedResolver(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ForcedResolver(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*ForcedResolver) + fc.Result = res + return ec.marshalNForcedResolver2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐForcedResolver(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_ForcedResolver(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "field": + return ec.fieldContext_ForcedResolver_field(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ForcedResolver", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_Status(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Status(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Status(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(Status) + fc.Result = res + return ec.marshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_Status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Status does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_Map(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Map(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Map(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Map) + fc.Result = res + return ec.marshalNMap2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMap(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_Map(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Map_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Map", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_overlapping(ctx, field) if err != nil { @@ -9608,6 +9924,48 @@ func (ec *executionContext) fieldContext_Query_issue896a(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _Query_LoopA(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_LoopA(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().LoopA(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*LoopA) + fc.Result = res + return ec.marshalOLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐLoopA(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_LoopA(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "b": + return ec.fieldContext_LoopA_b(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LoopA", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_mapStringInterface(ctx, field) if err != nil { @@ -10315,8 +10673,8 @@ func (ec *executionContext) fieldContext_Query_defaultScalar(ctx context.Context return fc, nil } -func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_slices(ctx, field) +func (ec *executionContext) _Query_EmbeddedDefaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_EmbeddedDefaultScalar(ctx, field) if err != nil { return graphql.Null } @@ -10329,18 +10687,21 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col }() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Slices(rctx) + return ec.resolvers.Query().EmbeddedDefaultScalar(rctx) }) if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*Slices) + res := resTmp.(*EmbeddedDefaultScalar) fc.Result = res - return ec.marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐSlices(ctx, field.Selections, res) + return ec.marshalNEmbeddedDefaultScalar2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedDefaultScalar(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_slices(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_EmbeddedDefaultScalar(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -10348,14 +10709,56 @@ func (ec *executionContext) fieldContext_Query_slices(ctx context.Context, field IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "test1": - return ec.fieldContext_Slices_test1(ctx, field) - case "test2": - return ec.fieldContext_Slices_test2(ctx, field) - case "test3": - return ec.fieldContext_Slices_test3(ctx, field) - case "test4": - return ec.fieldContext_Slices_test4(ctx, field) + case "value": + return ec.fieldContext_EmbeddedDefaultScalar_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type EmbeddedDefaultScalar", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_slices(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Slices(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*Slices) + fc.Result = res + return ec.marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐSlices(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_slices(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "test1": + return ec.fieldContext_Slices_test1(ctx, field) + case "test2": + return ec.fieldContext_Slices_test2(ctx, field) + case "test3": + return ec.fieldContext_Slices_test3(ctx, field) + case "test4": + return ec.fieldContext_Slices_test4(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Slices", field.Name) }, @@ -10626,6 +11029,44 @@ func (ec *executionContext) fieldContext_Query_validType(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _Query_Content_Child(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_Content_Child(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ContentChild(rctx) + }) + + if resTmp == nil { + return graphql.Null + } + res := resTmp.(ContentChild) + fc.Result = res + return ec.marshalOContent_Child2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐContentChild(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_Content_Child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Content_Child does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Query_variadicModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_variadicModel(ctx, field) if err != nil { @@ -10668,6 +11109,276 @@ func (ec *executionContext) fieldContext_Query_variadicModel(ctx context.Context return fc, nil } +func (ec *executionContext) _Query_asdfIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_asdfIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AsdfIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*AsdfIt) + fc.Result = res + return ec.marshalNasdfIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAsdfIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_asdfIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_asdfIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type asdfIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_AIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_AIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*AIt) + fc.Result = res + return ec.marshalNAIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_AIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_AIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_iIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_iIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().IIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*IIt) + fc.Result = res + return ec.marshalNiIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐIIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_iIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_iIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type iIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_XXIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_XXIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().XXIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*XXIt) + fc.Result = res + return ec.marshalNXXIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXXIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_XXIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_XXIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type XXIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_AbIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_AbIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AbIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*AbIt) + fc.Result = res + return ec.marshalNAbIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAbIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_AbIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_AbIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AbIt", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_XxIt(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_XxIt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().XxIt(rctx) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*XxIt) + fc.Result = res + return ec.marshalNXxIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXxIt(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_XxIt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_XxIt_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type XxIt", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_wrappedStruct(ctx, field) if err != nil { @@ -16884,18 +17595,98 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr Object: "Query", }) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "invalidIdentifier": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_invalidIdentifier(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "collision": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_collision(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "mapInput": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_mapInput(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "recursive": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_recursive(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "invalidIdentifier": + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "nestedInputs": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -16904,7 +17695,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_invalidIdentifier(ctx, field) + res = ec._Query_nestedInputs(ctx, field) return res } @@ -16915,7 +17706,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "collision": + case "nestedOutputs": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -16924,7 +17715,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_collision(ctx, field) + res = ec._Query_nestedOutputs(ctx, field) return res } @@ -16935,7 +17726,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "mapInput": + case "modelMethods": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -16944,7 +17735,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_mapInput(ctx, field) + res = ec._Query_modelMethods(ctx, field) return res } @@ -16955,7 +17746,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "recursive": + case "user": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -16964,7 +17755,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_recursive(ctx, field) + res = ec._Query_user(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -16975,7 +17769,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nestedInputs": + case "nullableArg": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -16984,7 +17778,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nestedInputs(ctx, field) + res = ec._Query_nullableArg(ctx, field) return res } @@ -16995,7 +17789,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nestedOutputs": + case "inputSlice": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17004,7 +17798,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nestedOutputs(ctx, field) + res = ec._Query_inputSlice(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17015,7 +17812,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "modelMethods": + case "inputNullableSlice": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17024,7 +17821,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_modelMethods(ctx, field) + res = ec._Query_inputNullableSlice(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17035,7 +17835,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "user": + case "shapeUnion": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17044,7 +17844,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_user(ctx, field) + res = ec._Query_shapeUnion(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17058,7 +17858,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "nullableArg": + case "autobind": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17067,7 +17867,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_nullableArg(ctx, field) + res = ec._Query_autobind(ctx, field) return res } @@ -17078,7 +17878,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "inputSlice": + case "deprecatedField": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17087,7 +17887,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_inputSlice(ctx, field) + res = ec._Query_deprecatedField(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17101,7 +17901,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "inputNullableSlice": + case "EmbeddedPointer": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17110,7 +17910,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_inputNullableSlice(ctx, field) + res = ec._Query_EmbeddedPointer(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17124,7 +17924,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "shapeUnion": + case "ForcedResolver": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17133,7 +17933,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_shapeUnion(ctx, field) + res = ec._Query_ForcedResolver(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17147,7 +17947,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "autobind": + case "Status": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17156,7 +17956,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_autobind(ctx, field) + res = ec._Query_Status(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17167,7 +17970,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "deprecatedField": + case "Map": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17176,7 +17979,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_deprecatedField(ctx, field) + res = ec._Query_Map(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17662,7 +18465,190 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "issue896a": + case "issue896a": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_issue896a(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "LoopA": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_LoopA(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "mapStringInterface": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_mapStringInterface(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "mapNestedStringInterface": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_mapNestedStringInterface(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "errorBubble": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_errorBubble(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "errorBubbleList": + field := field + + innerFunc := func(ctx context.Context) (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 + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "errorList": + field := field + + innerFunc := func(ctx context.Context) (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 + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "errors": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_errors(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "valid": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_valid(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) + } + + out.Concurrently(i, func() graphql.Marshaler { + return rrm(innerCtx) + }) + case "panics": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17671,7 +18657,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_issue896a(ctx, field) + res = ec._Query_panics(ctx, field) return res } @@ -17682,7 +18668,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "mapStringInterface": + case "primitiveObject": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17691,7 +18677,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_mapStringInterface(ctx, field) + res = ec._Query_primitiveObject(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17702,7 +18691,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "mapNestedStringInterface": + case "primitiveStringObject": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17711,7 +18700,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_mapNestedStringInterface(ctx, field) + res = ec._Query_primitiveStringObject(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17722,7 +18714,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "errorBubble": + case "ptrToSliceContainer": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17731,7 +18723,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_errorBubble(ctx, field) + res = ec._Query_ptrToSliceContainer(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17742,7 +18737,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "errorBubbleList": + case "infinity": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17751,7 +18746,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_errorBubbleList(ctx, field) + res = ec._Query_infinity(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17762,7 +18760,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "errorList": + case "stringFromContextInterface": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17771,7 +18769,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_errorList(ctx, field) + res = ec._Query_stringFromContextInterface(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17782,7 +18783,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "errors": + case "stringFromContextFunction": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17791,7 +18792,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_errors(ctx, field) + res = ec._Query_stringFromContextFunction(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17802,7 +18806,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "valid": + case "defaultScalar": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17811,7 +18815,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_valid(ctx, field) + res = ec._Query_defaultScalar(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17825,7 +18829,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "panics": + case "EmbeddedDefaultScalar": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17834,7 +18838,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_panics(ctx, field) + res = ec._Query_EmbeddedDefaultScalar(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -17845,7 +18852,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "primitiveObject": + case "slices": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17854,10 +18861,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_primitiveObject(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_slices(ctx, field) return res } @@ -17868,7 +18872,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "primitiveStringObject": + case "scalarSlice": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17877,7 +18881,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_primitiveStringObject(ctx, field) + res = ec._Query_scalarSlice(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17891,7 +18895,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "ptrToSliceContainer": + case "fallback": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17900,7 +18904,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_ptrToSliceContainer(ctx, field) + res = ec._Query_fallback(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -17914,7 +18918,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "infinity": + case "optionalUnion": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17923,10 +18927,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_infinity(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_optionalUnion(ctx, field) return res } @@ -17937,7 +18938,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "stringFromContextInterface": + case "vOkCaseValue": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17946,10 +18947,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_stringFromContextInterface(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_vOkCaseValue(ctx, field) return res } @@ -17960,7 +18958,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "stringFromContextFunction": + case "vOkCaseNil": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17969,10 +18967,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_stringFromContextFunction(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_vOkCaseNil(ctx, field) return res } @@ -17983,7 +18978,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "defaultScalar": + case "validType": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -17992,10 +18987,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_defaultScalar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_validType(ctx, field) return res } @@ -18006,7 +18998,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "slices": + case "Content_Child": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18015,7 +19007,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_slices(ctx, field) + res = ec._Query_Content_Child(ctx, field) return res } @@ -18026,7 +19018,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "scalarSlice": + case "variadicModel": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18035,10 +19027,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_scalarSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + res = ec._Query_variadicModel(ctx, field) return res } @@ -18049,7 +19038,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "fallback": + case "asdfIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18058,7 +19047,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_fallback(ctx, field) + res = ec._Query_asdfIt(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -18072,7 +19061,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "optionalUnion": + case "AIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18081,7 +19070,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_optionalUnion(ctx, field) + res = ec._Query_AIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -18092,7 +19084,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "vOkCaseValue": + case "iIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18101,7 +19093,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_vOkCaseValue(ctx, field) + res = ec._Query_iIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -18112,7 +19107,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "vOkCaseNil": + case "XXIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18121,7 +19116,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_vOkCaseNil(ctx, field) + res = ec._Query_XXIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -18132,7 +19130,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "validType": + case "AbIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18141,7 +19139,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_validType(ctx, field) + res = ec._Query_AbIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -18152,7 +19153,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Concurrently(i, func() graphql.Marshaler { return rrm(innerCtx) }) - case "variadicModel": + case "XxIt": field := field innerFunc := func(ctx context.Context) (res graphql.Marshaler) { @@ -18161,7 +19162,10 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_variadicModel(ctx, field) + res = ec._Query_XxIt(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } return res } @@ -19158,6 +20162,34 @@ func (ec *executionContext) _iIt(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** +func (ec *executionContext) marshalNAIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAIt(ctx context.Context, sel ast.SelectionSet, v AIt) graphql.Marshaler { + return ec._AIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAIt(ctx context.Context, sel ast.SelectionSet, v *AIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNAbIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAbIt(ctx context.Context, sel ast.SelectionSet, v AbIt) graphql.Marshaler { + return ec._AbIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAbIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAbIt(ctx context.Context, sel ast.SelectionSet, v *AbIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AbIt(ctx, sel, v) +} + func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) @@ -19248,6 +20280,34 @@ func (ec *executionContext) marshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋco return v } +func (ec *executionContext) marshalNEmbeddedDefaultScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedDefaultScalar(ctx context.Context, sel ast.SelectionSet, v EmbeddedDefaultScalar) graphql.Marshaler { + return ec._EmbeddedDefaultScalar(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEmbeddedDefaultScalar2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedDefaultScalar(ctx context.Context, sel ast.SelectionSet, v *EmbeddedDefaultScalar) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._EmbeddedDefaultScalar(ctx, sel, v) +} + +func (ec *executionContext) marshalNEmbeddedPointer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedPointerModel(ctx context.Context, sel ast.SelectionSet, v EmbeddedPointerModel) graphql.Marshaler { + return ec._EmbeddedPointer(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEmbeddedPointer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEmbeddedPointerModel(ctx context.Context, sel ast.SelectionSet, v *EmbeddedPointerModel) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._EmbeddedPointer(ctx, sel, v) +} + func (ec *executionContext) unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐEnumTest(ctx context.Context, v interface{}) (EnumTest, error) { var res EnumTest err := res.UnmarshalGQL(v) @@ -19303,6 +20363,20 @@ func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.S return graphql.WrapContextMarshaler(ctx, res) } +func (ec *executionContext) marshalNForcedResolver2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐForcedResolver(ctx context.Context, sel ast.SelectionSet, v ForcedResolver) graphql.Marshaler { + return ec._ForcedResolver(ctx, sel, &v) +} + +func (ec *executionContext) marshalNForcedResolver2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐForcedResolver(ctx context.Context, sel ast.SelectionSet, v *ForcedResolver) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ForcedResolver(ctx, sel, v) +} + func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalIntID(v) return res, graphql.ErrorOnPath(ctx, err) @@ -19428,6 +20502,20 @@ func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgen return ec._LoopB(ctx, sel, v) } +func (ec *executionContext) marshalNMap2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMap(ctx context.Context, sel ast.SelectionSet, v Map) graphql.Marshaler { + return ec._Map(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMap2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMap(ctx context.Context, sel ast.SelectionSet, v *Map) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Map(ctx, sel, v) +} + func (ec *executionContext) unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMarshalPanic(ctx context.Context, v interface{}) (MarshalPanic, error) { var res MarshalPanic err := res.UnmarshalGQL(v) @@ -19639,6 +20727,16 @@ func (ec *executionContext) unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgq return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐStatus(ctx context.Context, v interface{}) (Status, error) { + var res Status + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNStatus2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐStatus(ctx context.Context, sel ast.SelectionSet, v Status) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -19917,6 +21015,34 @@ func (ec *executionContext) marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋ return ec._WrappedStruct(ctx, sel, v) } +func (ec *executionContext) marshalNXXIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXXIt(ctx context.Context, sel ast.SelectionSet, v XXIt) graphql.Marshaler { + return ec._XXIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNXXIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXXIt(ctx context.Context, sel ast.SelectionSet, v *XXIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._XXIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNXxIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXxIt(ctx context.Context, sel ast.SelectionSet, v XxIt) graphql.Marshaler { + return ec._XxIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNXxIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐXxIt(ctx context.Context, sel ast.SelectionSet, v *XxIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._XxIt(ctx, sel, v) +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } @@ -20170,6 +21296,34 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a return res } +func (ec *executionContext) marshalNasdfIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAsdfIt(ctx context.Context, sel ast.SelectionSet, v AsdfIt) graphql.Marshaler { + return ec._asdfIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNasdfIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAsdfIt(ctx context.Context, sel ast.SelectionSet, v *AsdfIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._asdfIt(ctx, sel, v) +} + +func (ec *executionContext) marshalNiIt2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐIIt(ctx context.Context, sel ast.SelectionSet, v IIt) graphql.Marshaler { + return ec._iIt(ctx, sel, &v) +} + +func (ec *executionContext) marshalNiIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐIIt(ctx context.Context, sel ast.SelectionSet, v *IIt) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._iIt(ctx, sel, v) +} + func (ec *executionContext) marshalOAnimal2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐAnimal(ctx context.Context, sel ast.SelectionSet, v Animal) graphql.Marshaler { if v == nil { return graphql.Null @@ -20326,6 +21480,13 @@ func (ec *executionContext) marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgen return ec._Circle(ctx, sel, v) } +func (ec *executionContext) marshalOContent_Child2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐContentChild(ctx context.Context, sel ast.SelectionSet, v ContentChild) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Content_Child(ctx, sel, v) +} + func (ec *executionContext) marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐCoordinates(ctx context.Context, sel ast.SelectionSet, v Coordinates) graphql.Marshaler { return ec._Coordinates(ctx, sel, &v) } @@ -20533,6 +21694,13 @@ func (ec *executionContext) marshalOIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋco return ec._It(ctx, sel, v) } +func (ec *executionContext) marshalOLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐLoopA(ctx context.Context, sel ast.SelectionSet, v *LoopA) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._LoopA(ctx, sel, v) +} + func (ec *executionContext) unmarshalOMapStringInterfaceInput2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { if v == nil { return nil, nil diff --git a/codegen/testserver/singlefile/loops.graphql b/codegen/testserver/singlefile/loops.graphql index 0254ef4a0e6..4e72d40e09b 100644 --- a/codegen/testserver/singlefile/loops.graphql +++ b/codegen/testserver/singlefile/loops.graphql @@ -1,3 +1,7 @@ +extend type Query { + LoopA: LoopA +} + type LoopA { b: LoopB! } diff --git a/codegen/testserver/singlefile/resolver.go b/codegen/testserver/singlefile/resolver.go index 87ca51c010b..bd63699af7a 100644 --- a/codegen/testserver/singlefile/resolver.go +++ b/codegen/testserver/singlefile/resolver.go @@ -140,6 +140,22 @@ func (r *queryResolver) DeprecatedField(ctx context.Context) (string, error) { panic("not implemented") } +func (r *queryResolver) EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) { + panic("not implemented") +} + +func (r *queryResolver) ForcedResolver(ctx context.Context) (*ForcedResolver, error) { + panic("not implemented") +} + +func (r *queryResolver) Status(ctx context.Context) (Status, error) { + panic("not implemented") +} + +func (r *queryResolver) Map(ctx context.Context) (*Map, error) { + panic("not implemented") +} + func (r *queryResolver) Overlapping(ctx context.Context) (*OverlappingFields, error) { panic("not implemented") } @@ -236,6 +252,10 @@ func (r *queryResolver) Issue896a(ctx context.Context) ([]*CheckIssue896, error) panic("not implemented") } +func (r *queryResolver) LoopA(ctx context.Context) (*LoopA, error) { + panic("not implemented") +} + func (r *queryResolver) MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { panic("not implemented") } @@ -296,6 +316,10 @@ func (r *queryResolver) DefaultScalar(ctx context.Context, arg string) (string, panic("not implemented") } +func (r *queryResolver) EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) { + panic("not implemented") +} + func (r *queryResolver) Slices(ctx context.Context) (*Slices, error) { panic("not implemented") } @@ -324,10 +348,38 @@ func (r *queryResolver) ValidType(ctx context.Context) (*ValidType, error) { panic("not implemented") } +func (r *queryResolver) ContentChild(ctx context.Context) (ContentChild, error) { + panic("not implemented") +} + func (r *queryResolver) VariadicModel(ctx context.Context) (*VariadicModel, error) { panic("not implemented") } +func (r *queryResolver) AsdfIt(ctx context.Context) (*AsdfIt, error) { + panic("not implemented") +} + +func (r *queryResolver) AIt(ctx context.Context) (*AIt, error) { + panic("not implemented") +} + +func (r *queryResolver) IIt(ctx context.Context) (*IIt, error) { + panic("not implemented") +} + +func (r *queryResolver) XXIt(ctx context.Context) (*XXIt, error) { + panic("not implemented") +} + +func (r *queryResolver) AbIt(ctx context.Context) (*AbIt, error) { + panic("not implemented") +} + +func (r *queryResolver) XxIt(ctx context.Context) (*XxIt, error) { + panic("not implemented") +} + func (r *queryResolver) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { panic("not implemented") } diff --git a/codegen/testserver/singlefile/scalar_default.graphql b/codegen/testserver/singlefile/scalar_default.graphql index 5e3a9c08fd1..eaf56b0e5c5 100644 --- a/codegen/testserver/singlefile/scalar_default.graphql +++ b/codegen/testserver/singlefile/scalar_default.graphql @@ -1,5 +1,6 @@ extend type Query { defaultScalar(arg: DefaultScalarImplementation! = "default"): DefaultScalarImplementation! + EmbeddedDefaultScalar: EmbeddedDefaultScalar! } """ This doesnt have an implementation in the typemap, so it should act like a string """ diff --git a/codegen/testserver/singlefile/schema.graphql b/codegen/testserver/singlefile/schema.graphql index 5ce31b8b384..b4bb10f1eb6 100644 --- a/codegen/testserver/singlefile/schema.graphql +++ b/codegen/testserver/singlefile/schema.graphql @@ -22,6 +22,9 @@ type Query { shapeUnion: ShapeUnion! autobind: Autobind deprecatedField: String! @deprecated(reason: "test deprecated directive") + EmbeddedPointer: EmbeddedPointer! + ForcedResolver: ForcedResolver! + Status: Status! } type Subscription { diff --git a/codegen/testserver/singlefile/stub.go b/codegen/testserver/singlefile/stub.go index 40305096641..16d537cf3c2 100644 --- a/codegen/testserver/singlefile/stub.go +++ b/codegen/testserver/singlefile/stub.go @@ -64,6 +64,10 @@ type Stub struct { ShapeUnion func(ctx context.Context) (ShapeUnion, error) Autobind func(ctx context.Context) (*Autobind, error) DeprecatedField func(ctx context.Context) (string, error) + EmbeddedPointer func(ctx context.Context) (*EmbeddedPointerModel, error) + ForcedResolver func(ctx context.Context) (*ForcedResolver, error) + Status func(ctx context.Context) (Status, error) + Map func(ctx context.Context) (*Map, error) Overlapping func(ctx context.Context) (*OverlappingFields, error) DefaultParameters func(ctx context.Context, falsyBoolean *bool, truthyBoolean *bool) (*DefaultParametersMirror, error) DirectiveArg func(ctx context.Context, arg string) (*string, error) @@ -88,6 +92,7 @@ type Stub struct { Animal func(ctx context.Context) (Animal, error) NotAnInterface func(ctx context.Context) (BackedByInterface, error) Issue896a func(ctx context.Context) ([]*CheckIssue896, error) + LoopA func(ctx context.Context) (*LoopA, error) 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) @@ -103,6 +108,7 @@ type Stub struct { StringFromContextInterface func(ctx context.Context) (*StringFromContextInterface, error) StringFromContextFunction func(ctx context.Context) (string, error) DefaultScalar func(ctx context.Context, arg string) (string, error) + EmbeddedDefaultScalar func(ctx context.Context) (*EmbeddedDefaultScalar, error) Slices func(ctx context.Context) (*Slices, error) ScalarSlice func(ctx context.Context) ([]byte, error) Fallback func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) @@ -110,7 +116,14 @@ type Stub struct { VOkCaseValue func(ctx context.Context) (*VOkCaseValue, error) VOkCaseNil func(ctx context.Context) (*VOkCaseNil, error) ValidType func(ctx context.Context) (*ValidType, error) + ContentChild func(ctx context.Context) (ContentChild, error) VariadicModel func(ctx context.Context) (*VariadicModel, error) + AsdfIt func(ctx context.Context) (*AsdfIt, error) + AIt func(ctx context.Context) (*AIt, error) + IIt func(ctx context.Context) (*IIt, error) + XXIt func(ctx context.Context) (*XXIt, error) + AbIt func(ctx context.Context) (*AbIt, error) + XxIt func(ctx context.Context) (*XxIt, error) WrappedStruct func(ctx context.Context) (*WrappedStruct, error) WrappedScalar func(ctx context.Context) (otherpkg.Scalar, error) WrappedMap func(ctx context.Context) (WrappedMap, error) @@ -312,6 +325,18 @@ func (r *stubQuery) Autobind(ctx context.Context) (*Autobind, error) { func (r *stubQuery) DeprecatedField(ctx context.Context) (string, error) { return r.QueryResolver.DeprecatedField(ctx) } +func (r *stubQuery) EmbeddedPointer(ctx context.Context) (*EmbeddedPointerModel, error) { + return r.QueryResolver.EmbeddedPointer(ctx) +} +func (r *stubQuery) ForcedResolver(ctx context.Context) (*ForcedResolver, error) { + return r.QueryResolver.ForcedResolver(ctx) +} +func (r *stubQuery) Status(ctx context.Context) (Status, error) { + return r.QueryResolver.Status(ctx) +} +func (r *stubQuery) Map(ctx context.Context) (*Map, error) { + return r.QueryResolver.Map(ctx) +} func (r *stubQuery) Overlapping(ctx context.Context) (*OverlappingFields, error) { return r.QueryResolver.Overlapping(ctx) } @@ -384,6 +409,9 @@ func (r *stubQuery) NotAnInterface(ctx context.Context) (BackedByInterface, erro func (r *stubQuery) Issue896a(ctx context.Context) ([]*CheckIssue896, error) { return r.QueryResolver.Issue896a(ctx) } +func (r *stubQuery) LoopA(ctx context.Context) (*LoopA, error) { + return r.QueryResolver.LoopA(ctx) +} func (r *stubQuery) MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { return r.QueryResolver.MapStringInterface(ctx, in) } @@ -429,6 +457,9 @@ func (r *stubQuery) StringFromContextFunction(ctx context.Context) (string, erro func (r *stubQuery) DefaultScalar(ctx context.Context, arg string) (string, error) { return r.QueryResolver.DefaultScalar(ctx, arg) } +func (r *stubQuery) EmbeddedDefaultScalar(ctx context.Context) (*EmbeddedDefaultScalar, error) { + return r.QueryResolver.EmbeddedDefaultScalar(ctx) +} func (r *stubQuery) Slices(ctx context.Context) (*Slices, error) { return r.QueryResolver.Slices(ctx) } @@ -450,9 +481,30 @@ func (r *stubQuery) VOkCaseNil(ctx context.Context) (*VOkCaseNil, error) { func (r *stubQuery) ValidType(ctx context.Context) (*ValidType, error) { return r.QueryResolver.ValidType(ctx) } +func (r *stubQuery) ContentChild(ctx context.Context) (ContentChild, error) { + return r.QueryResolver.ContentChild(ctx) +} func (r *stubQuery) VariadicModel(ctx context.Context) (*VariadicModel, error) { return r.QueryResolver.VariadicModel(ctx) } +func (r *stubQuery) AsdfIt(ctx context.Context) (*AsdfIt, error) { + return r.QueryResolver.AsdfIt(ctx) +} +func (r *stubQuery) AIt(ctx context.Context) (*AIt, error) { + return r.QueryResolver.AIt(ctx) +} +func (r *stubQuery) IIt(ctx context.Context) (*IIt, error) { + return r.QueryResolver.IIt(ctx) +} +func (r *stubQuery) XXIt(ctx context.Context) (*XXIt, error) { + return r.QueryResolver.XXIt(ctx) +} +func (r *stubQuery) AbIt(ctx context.Context) (*AbIt, error) { + return r.QueryResolver.AbIt(ctx) +} +func (r *stubQuery) XxIt(ctx context.Context) (*XxIt, error) { + return r.QueryResolver.XxIt(ctx) +} func (r *stubQuery) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { return r.QueryResolver.WrappedStruct(ctx) } diff --git a/codegen/testserver/singlefile/validtypes.graphql b/codegen/testserver/singlefile/validtypes.graphql index 9912e9a9515..7d53ab4c543 100644 --- a/codegen/testserver/singlefile/validtypes.graphql +++ b/codegen/testserver/singlefile/validtypes.graphql @@ -1,5 +1,6 @@ extend type Query { validType: ValidType + Content_Child: Content_Child } """ These things are all valid, but without care generate invalid go code """ diff --git a/codegen/testserver/singlefile/weird_type_cases.graphql b/codegen/testserver/singlefile/weird_type_cases.graphql index afd440f1d12..cce83f20dea 100644 --- a/codegen/testserver/singlefile/weird_type_cases.graphql +++ b/codegen/testserver/singlefile/weird_type_cases.graphql @@ -1,5 +1,14 @@ # regression test for https://github.com/99designs/gqlgen/issues/583 +extend type Query { + asdfIt: asdfIt! + AIt: AIt! + iIt: iIt! + XXIt: XXIt! + AbIt: AbIt! + XxIt: XxIt! +} + type asdfIt { id: ID! } type iIt { id: ID! } type AIt { id: ID! } diff --git a/plugin/federation/federation_test.go b/plugin/federation/federation_test.go index 75fb462b8ca..59e0472c5a7 100644 --- a/plugin/federation/federation_test.go +++ b/plugin/federation/federation_test.go @@ -181,12 +181,12 @@ func load(t *testing.T, name string) (*federation, *config.Config) { f := &federation{Version: cfg.Federation.Version} cfg.Sources = append(cfg.Sources, f.InjectSourceEarly()) - require.NoError(t, cfg.LoadSchema()) + require.NoError(t, cfg.LoadSchema(false)) if src := f.InjectSourceLate(cfg.Schema); src != nil { cfg.Sources = append(cfg.Sources, src) } - require.NoError(t, cfg.LoadSchema()) + require.NoError(t, cfg.LoadSchema(true)) require.NoError(t, cfg.Init()) return f, cfg diff --git a/plugin/modelgen/testdata/schema.graphql b/plugin/modelgen/testdata/schema.graphql index 16556243bf7..bb173881f27 100644 --- a/plugin/modelgen/testdata/schema.graphql +++ b/plugin/modelgen/testdata/schema.graphql @@ -5,6 +5,15 @@ directive @goTag( type Query { thisShoudlntGetGenerated: Boolean + ExistingUnion: ExistingUnion! + EnumWithDescription: EnumWithDescription! + InterfaceWithDescription: InterfaceWithDescription! + _Foo_Barr: _Foo_Barr! + A: A! + B: B! + C: C! + D(e: ExistingInput!, m: MissingInput): D! + FieldMutationHook: FieldMutationHook! } type Mutation {