diff options
author | Michael Muré <batolettre@gmail.com> | 2018-12-23 17:11:37 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-12-23 17:11:37 +0100 |
commit | 1410a1af75b1ab9ea3f980a7e372728f9a123abf (patch) | |
tree | e24db8f84c48b20158b1f1fd6d281d700421279c /vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go | |
parent | 8fc15a032f021c855abf66ed303c003d57c340ea (diff) | |
download | git-bug-1410a1af75b1ab9ea3f980a7e372728f9a123abf.tar.gz |
upgrade gqlgen to v0.7.1
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go index baff882e..ca0b065f 100644 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go +++ b/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go @@ -12,19 +12,17 @@ type ( } EnumValue struct { - Name string - Description string - IsDeprecated bool - DeprecationReason string + Name string + Description string + deprecation *ast.Directive } Field struct { - Name string - Description string - Type *Type - Args []InputValue - IsDeprecated bool - DeprecationReason string + Name string + Description string + Type *Type + Args []InputValue + deprecation *ast.Directive } InputValue struct { @@ -39,20 +37,36 @@ func WrapSchema(schema *ast.Schema) *Schema { return &Schema{schema: schema} } -func isDeprecated(directives ast.DirectiveList) bool { - return directives.ForName("deprecated") != nil +func (f *EnumValue) IsDeprecated() bool { + return f.deprecation != nil +} + +func (f *EnumValue) DeprecationReason() *string { + if f.deprecation == nil { + return nil + } + + reason := f.deprecation.Arguments.ForName("reason") + if reason == nil { + return nil + } + + return &reason.Value.Raw +} + +func (f *Field) IsDeprecated() bool { + return f.deprecation != nil } -func deprecationReason(directives ast.DirectiveList) string { - deprecation := directives.ForName("deprecated") - if deprecation == nil { - return "" +func (f *Field) DeprecationReason() *string { + if f.deprecation == nil { + return nil } - reason := deprecation.Arguments.ForName("reason") + reason := f.deprecation.Arguments.ForName("reason") if reason == nil { - return "" + return nil } - return reason.Value.Raw + return &reason.Value.Raw } |