Module: GraphQL::Stitching::Supergraph::Visibility

Included in:
ArgumentType, EnumType, EnumValueType, FieldType, InputObjectType, ObjectType, ScalarType, UnionType
Defined in:
lib/graphql/stitching/supergraph/types.rb

Instance Method Summary collapse

Instance Method Details

#visible?(ctx) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/graphql/stitching/supergraph/types.rb', line 6

def visible?(ctx)
  profile = ctx[:visibility_profile]
  return true if profile.nil?

  directive = directives.find { _1.graphql_name == GraphQL::Stitching.visibility_directive }
  return true if directive.nil?

  profiles = directive.arguments.keyword_arguments[:profiles]
  return true if profiles.nil?

  profiles.include?(profile)
end