Skip to content

Commit

Permalink
Fix Playground marking fields as @deprecated when they're not
Browse files Browse the repository at this point in the history
Fixes #504
  • Loading branch information
MarkKremer committed Nov 2, 2019
1 parent 5fa0612 commit d0c0ac3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 50 deletions.
16 changes: 16 additions & 0 deletions introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ func init() {
},
"deprecationReason": &Field{
Type: String,
Resolve: func(p ResolveParams) (interface{}, error) {
if field, ok := p.Source.(*FieldDefinition); ok {
if field.DeprecationReason != "" {
return field.DeprecationReason, nil
}
}
return nil, nil
},
},
},
})
Expand Down Expand Up @@ -497,6 +505,14 @@ func init() {
},
"deprecationReason": &Field{
Type: String,
Resolve: func(p ResolveParams) (interface{}, error) {
if field, ok := p.Source.(*EnumValueDefinition); ok {
if field.DeprecationReason != "" {
return field.DeprecationReason, nil
}
}
return nil, nil
},
},
},
})
Expand Down
Loading

0 comments on commit d0c0ac3

Please sign in to comment.