Skip to content

Commit d0c0ac3

Browse files
committed
Fix Playground marking fields as @deprecated when they're not
Fixes #504
1 parent 5fa0612 commit d0c0ac3

File tree

2 files changed

+66
-50
lines changed

2 files changed

+66
-50
lines changed

introspection.go

+16
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ func init() {
312312
},
313313
"deprecationReason": &Field{
314314
Type: String,
315+
Resolve: func(p ResolveParams) (interface{}, error) {
316+
if field, ok := p.Source.(*FieldDefinition); ok {
317+
if field.DeprecationReason != "" {
318+
return field.DeprecationReason, nil
319+
}
320+
}
321+
return nil, nil
322+
},
315323
},
316324
},
317325
})
@@ -497,6 +505,14 @@ func init() {
497505
},
498506
"deprecationReason": &Field{
499507
Type: String,
508+
Resolve: func(p ResolveParams) (interface{}, error) {
509+
if field, ok := p.Source.(*EnumValueDefinition); ok {
510+
if field.DeprecationReason != "" {
511+
return field.DeprecationReason, nil
512+
}
513+
}
514+
return nil, nil
515+
},
500516
},
501517
},
502518
})

0 commit comments

Comments
 (0)