From 1410a1af75b1ab9ea3f980a7e372728f9a123abf Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 23 Dec 2018 17:11:37 +0100 Subject: upgrade gqlgen to v0.7.1 --- .../gqlgen/graphql/introspection/introspection.go | 52 ++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go') 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 } -- cgit