@@ -421,3 +421,42 @@ func TestTypeSystem_EnumValues_EnumValueMayBePointer(t *testing.T) {
421
421
t .Fatalf ("Unexpected result, Diff: %v" , testutil .Diff (expected , result ))
422
422
}
423
423
}
424
+
425
+ func TestTypeSystem_EnumValues_EnumValueMayBeNilPointer (t * testing.T ) {
426
+ var enumTypeTestSchema , _ = graphql .NewSchema (graphql.SchemaConfig {
427
+ Query : graphql .NewObject (graphql.ObjectConfig {
428
+ Name : "Query" ,
429
+ Fields : graphql.Fields {
430
+ "query" : & graphql.Field {
431
+ Type : graphql .NewObject (graphql.ObjectConfig {
432
+ Name : "query" ,
433
+ Fields : graphql.Fields {
434
+ "color" : & graphql.Field {
435
+ Type : enumTypeTestColorType ,
436
+ },
437
+ },
438
+ }),
439
+ Resolve : func (_ graphql.ResolveParams ) (interface {}, error ) {
440
+ return struct {
441
+ Color * int `graphql:"color"`
442
+ }{nil }, nil
443
+ },
444
+ },
445
+ },
446
+ }),
447
+ })
448
+ query := "{ query { color } }"
449
+ expected := & graphql.Result {
450
+ Data : map [string ]interface {}{
451
+ "query" : map [string ]interface {}{
452
+ "color" : nil ,
453
+ }},
454
+ }
455
+ result := g (t , graphql.Params {
456
+ Schema : enumTypeTestSchema ,
457
+ RequestString : query ,
458
+ })
459
+ if ! reflect .DeepEqual (expected , result ) {
460
+ t .Fatalf ("Unexpected result, Diff: %v" , testutil .Diff (expected , result ))
461
+ }
462
+ }
0 commit comments