Skip to content

Commit 9d304f9

Browse files
committed
fix compile errors introduced by ab449f0
1 parent d579b56 commit 9d304f9

File tree

8 files changed

+24
-30
lines changed

8 files changed

+24
-30
lines changed

internal/exec/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func execFieldSelection(ctx context.Context, r *Request, s *resolvable.Schema, f
174174
var result reflect.Value
175175
var err *errors.QueryError
176176

177-
traceCtx, finish := r.Tracer.TraceField(ctx, f.field.TraceLabel, f.field.TypeName, f.field.Name.Name, !f.field.Async, f.field.Args)
177+
traceCtx, finish := r.Tracer.TraceField(ctx, f.field.TraceLabel, f.field.TypeName, f.field.Name, !f.field.Async, f.field.Args)
178178
defer func() {
179179
finish(err)
180180
}()

internal/exec/resolvable/meta.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,23 @@ func newMeta(s *types.Schema) *Meta {
3939

4040
fieldTypename := Field{
4141
FieldDefinition: types.FieldDefinition{
42-
Name: types.Ident{
43-
Name: "__typename",
44-
},
42+
Name: "__typename",
4543
Type: &types.NonNull{OfType: s.Types["String"]},
4644
},
4745
TraceLabel: fmt.Sprintf("GraphQL field: __typename"),
4846
}
4947

5048
fieldSchema := Field{
5149
FieldDefinition: types.FieldDefinition{
52-
Name: types.Ident{
53-
Name: "__schema",
54-
},
50+
Name: "__schema",
5551
Type: s.Types["__Schema"],
5652
},
5753
TraceLabel: fmt.Sprintf("GraphQL field: __schema"),
5854
}
5955

6056
fieldType := Field{
6157
FieldDefinition: types.FieldDefinition{
62-
Name: types.Ident{
63-
Name: "__type",
64-
},
58+
Name: "__type",
6559
Type: s.Types["__Type"],
6660
},
6761
TraceLabel: fmt.Sprintf("GraphQL field: __type"),

internal/exec/resolvable/resolvable.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ func (b *execBuilder) makeObjectExec(typeName string, fields types.FieldsDefinit
233233
fieldsCount := fieldCount(rt, map[string]int{})
234234
for _, f := range fields {
235235
var fieldIndex []int
236-
methodIndex := findMethod(resolverType, f.Name.Name)
236+
methodIndex := findMethod(resolverType, f.Name)
237237
if b.schema.UseFieldResolvers && methodIndex == -1 {
238-
if fieldsCount[strings.ToLower(stripUnderscore(f.Name.Name))] > 1 {
239-
return nil, fmt.Errorf("%s does not resolve %q: ambiguous field %q", resolverType, typeName, f.Name.Name)
238+
if fieldsCount[strings.ToLower(stripUnderscore(f.Name))] > 1 {
239+
return nil, fmt.Errorf("%s does not resolve %q: ambiguous field %q", resolverType, typeName, f.Name)
240240
}
241-
fieldIndex = findField(rt, f.Name.Name, []int{})
241+
fieldIndex = findField(rt, f.Name, []int{})
242242
}
243243
if methodIndex == -1 && len(fieldIndex) == 0 {
244244
hint := ""
245-
if findMethod(reflect.PtrTo(resolverType), f.Name.Name) != -1 {
245+
if findMethod(reflect.PtrTo(resolverType), f.Name) != -1 {
246246
hint = " (hint: the method exists on the pointer type)"
247247
}
248248
return nil, fmt.Errorf("%s does not resolve %q: missing method for field %q%s", resolverType, typeName, f.Name, hint)
@@ -259,7 +259,7 @@ func (b *execBuilder) makeObjectExec(typeName string, fields types.FieldsDefinit
259259
if err != nil {
260260
return nil, fmt.Errorf("%s\n\tused by (%s).%s", err, resolverType, m.Name)
261261
}
262-
Fields[f.Name.Name] = fe
262+
Fields[f.Name] = fe
263263
}
264264

265265
// Check type assertions when
@@ -358,7 +358,7 @@ func (b *execBuilder) makeFieldExec(typeName string, f *types.FieldDefinition, m
358358
HasContext: hasContext,
359359
ArgsPacker: argsPacker,
360360
HasError: hasError,
361-
TraceLabel: fmt.Sprintf("GraphQL field: %s.%s", typeName, f.Name.Name),
361+
TraceLabel: fmt.Sprintf("GraphQL field: %s.%s", typeName, f.Name),
362362
}
363363

364364
var out reflect.Type

internal/schema/schema.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ func mergeExtensions(s *types.Schema) error {
159159
e := ext.Type.(*types.ObjectTypeDefinition)
160160

161161
for _, field := range e.Fields {
162-
if og.Fields.Get(field.Name.Name) != nil {
163-
return fmt.Errorf("extended field %q already exists", field.Name.Name)
162+
if og.Fields.Get(field.Name) != nil {
163+
return fmt.Errorf("extended field %q already exists", field.Name)
164164
}
165165
}
166166
og.Fields = append(og.Fields, e.Fields...)
@@ -188,8 +188,8 @@ func mergeExtensions(s *types.Schema) error {
188188
e := ext.Type.(*types.InterfaceTypeDefinition)
189189

190190
for _, field := range e.Fields {
191-
if og.Fields.Get(field.Name.Name) != nil {
192-
return fmt.Errorf("extended field %s already exists", field.Name.Name)
191+
if og.Fields.Get(field.Name) != nil {
192+
return fmt.Errorf("extended field %s already exists", field.Name)
193193
}
194194
}
195195
og.Fields = append(og.Fields, e.Fields...)
@@ -526,7 +526,7 @@ func parseFieldsDef(l *common.Lexer) types.FieldsDefinition {
526526
for l.Peek() != '}' {
527527
f := &types.FieldDefinition{}
528528
f.Desc = l.DescComment()
529-
f.Name = l.ConsumeIdentWithLoc()
529+
f.Name = l.ConsumeIdent()
530530
if l.Peek() == '(' {
531531
l.ConsumeToken('(')
532532
for l.Peek() != ')' {

internal/schema/schema_internal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestParseInterfaceDef(t *testing.T) {
1919
tests := []testCase{{
2020
description: "Parses simple interface",
2121
definition: "Greeting { field: String }",
22-
expected: &types.InterfaceTypeDefinition{Name: "Greeting", Fields: types.FieldsDefinition{&types.FieldDefinition{Name: types.Ident{Name: "field"}}}},
22+
expected: &types.InterfaceTypeDefinition{Name: "Greeting", Fields: types.FieldsDefinition{&types.FieldDefinition{Name: "field"}}},
2323
}}
2424

2525
for _, test := range tests {
@@ -118,7 +118,7 @@ func compareInterfaces(t *testing.T, expected, actual *types.InterfaceTypeDefini
118118
}
119119

120120
for i, f := range expected.Fields {
121-
if f.Name.Name != actual.Fields[i].Name.Name {
121+
if f.Name != actual.Fields[i].Name {
122122
t.Errorf("fields[%d]: wrong field name: want %q, got %q", i, f.Name, actual.Fields[i].Name)
123123
}
124124
}

internal/schema/schema_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestParse(t *testing.T) {
2929
return fmt.Errorf("invalid number of fields: want %d, have %d", want, have)
3030
}
3131
const fieldName = "message"
32-
if typ.Fields[0].Name.Name != fieldName {
32+
if typ.Fields[0].Name != fieldName {
3333
return fmt.Errorf("field %q not found", fieldName)
3434
}
3535
return nil
@@ -746,7 +746,7 @@ Second line of the description.
746746
"category": struct{}{},
747747
}
748748
for _, f := range typ.Fields {
749-
if _, ok := fields[f.Name.Name]; !ok {
749+
if _, ok := fields[f.Name]; !ok {
750750
return fmt.Errorf("Unexpected field %q", f.Name)
751751
}
752752
}

internal/validation/validation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,17 @@ func validateSelection(c *opContext, sel types.Selection, t types.NamedType) {
294294
switch fieldName {
295295
case "__typename":
296296
f = &types.FieldDefinition{
297-
Name: types.Ident{Name: "__typename"},
297+
Name: "__typename",
298298
Type: c.schema.Types["String"],
299299
}
300300
case "__schema":
301301
f = &types.FieldDefinition{
302-
Name: types.Ident{Name: "__schema"},
302+
Name: "__schema",
303303
Type: c.schema.Types["__Schema"],
304304
}
305305
case "__type":
306306
f = &types.FieldDefinition{
307-
Name: types.Ident{Name: "__type"},
307+
Name: "__type",
308308
Arguments: types.ArgumentsDefinition{
309309
&types.InputValueDefinition{
310310
Name: types.Ident{Name: "name"},

introspection/introspection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ type Field struct {
194194
}
195195

196196
func (r *Field) Name() string {
197-
return r.field.Name.Name
197+
return r.field.Name
198198
}
199199

200200
func (r *Field) Description() *string {

0 commit comments

Comments
 (0)