@@ -57,20 +57,20 @@ type customDirectiveVisitor struct {
57
57
beforeWasCalled bool
58
58
}
59
59
60
- func (v * customDirectiveVisitor ) Before (ctx context.Context , directive * types.Directive , input interface {} ) error {
60
+ func (v * customDirectiveVisitor ) Before (ctx context.Context , directive * types.Directive , input string ) error {
61
61
v .beforeWasCalled = true
62
62
return nil
63
63
}
64
64
65
- func (v * customDirectiveVisitor ) After (ctx context.Context , directive * types.Directive , output interface {} ) (interface {} , error ) {
65
+ func (v * customDirectiveVisitor ) After (ctx context.Context , directive * types.Directive , output string ) (string , error ) {
66
66
if v .beforeWasCalled == false {
67
- return nil , errors .New ("Before directive visitor method wasn't called." )
67
+ return "" , errors .New ("Before directive visitor method wasn't called." )
68
68
}
69
69
70
70
if value , ok := directive .Arguments .Get ("customAttribute" ); ok {
71
- return fmt .Sprintf ("Directive '%s' (with arg '%s') modified result: %s" , directive .Name .Name , value .String (), output .( string ) ), nil
71
+ return fmt .Sprintf ("Directive '%s' (with arg '%s') modified result: %s" , directive .Name .Name , value .String (), output ), nil
72
72
}
73
- return fmt .Sprintf ("Directive '%s' modified result: %s" , directive .Name .Name , output .( string ) ), nil
73
+ return fmt .Sprintf ("Directive '%s' modified result: %s" , directive .Name .Name , output ), nil
74
74
}
75
75
76
76
type theNumberResolver struct {
@@ -286,7 +286,7 @@ func TestCustomDirective(t *testing.T) {
286
286
hello_html: String! @customDirective
287
287
}
288
288
` , & helloSnakeResolver1 {},
289
- graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor {
289
+ graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor [ any , any ] {
290
290
"customDirective" : & customDirectiveVisitor {},
291
291
})),
292
292
Query : `
@@ -314,7 +314,7 @@ func TestCustomDirective(t *testing.T) {
314
314
say_hello(full_name: String!): String! @customDirective(customAttribute: hi)
315
315
}
316
316
` , & helloSnakeResolver1 {},
317
- graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor {
317
+ graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor [ any , any ] {
318
318
"customDirective" : & customDirectiveVisitor {},
319
319
})),
320
320
Query : `
@@ -335,7 +335,7 @@ func TestCustomDirectiveStructFieldResolver(t *testing.T) {
335
335
t .Parallel ()
336
336
337
337
schemaOpt := []graphql.SchemaOpt {
338
- graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor {
338
+ graphql .DirectiveVisitors (map [string ]types.DirectiveVisitor [ any , any ] {
339
339
"customDirective" : & customDirectiveVisitor {},
340
340
}),
341
341
graphql .UseFieldResolvers (),
0 commit comments