Skip to content

Commit

Permalink
fix: use "No longer supported" as the default deprecationReason for d…
Browse files Browse the repository at this point in the history
…eprecated fields with no reason specified
  • Loading branch information
arseniocosta1 committed Jun 23, 2023
1 parent 5ac9fe5 commit 38d7e75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions graphql/introspection/introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ func (f *Field) IsDeprecated() bool {
}

func (f *Field) DeprecationReason() *string {
if f.deprecation == nil {
if f.deprecation == nil || !f.IsDeprecated() {
return nil
}

reason := f.deprecation.Arguments.ForName("reason")

if reason == nil {
return nil
defaultReason := "No longer supported"
return &defaultReason
}

return &reason.Value.Raw
Expand Down

0 comments on commit 38d7e75

Please sign in to comment.