Class: GraphQL::Stitching::ExportSelection
- Inherits:
-
Object
- Object
- GraphQL::Stitching::ExportSelection
- Defined in:
- lib/graphql/stitching/export_selection.rb
Overview
Builds hidden selection fields added by stitiching code, used to request operational data about resolved objects.
Constant Summary collapse
- EXPORT_PREFIX =
"_export_"
- FIELD_ALIAS_KWARG =
The argument assigning Field.alias changed from a generic
alias
hash key to a structuredfield_alias
kwarg. See https://github.com/rmosolgo/graphql-ruby/pull/4718 !GraphQL::Language::Nodes::Field.new(field_alias: "a").alias.nil?
Class Method Summary collapse
Class Method Details
.key(name) ⇒ Object
19 20 21 |
# File 'lib/graphql/stitching/export_selection.rb', line 19 def key(name) "#{EXPORT_PREFIX}#{name}" end |
.key?(name) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/graphql/stitching/export_selection.rb', line 13 def key?(name) return false unless name name.start_with?(EXPORT_PREFIX) end |
.key_node(field_name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/graphql/stitching/export_selection.rb', line 28 def key_node(field_name) if FIELD_ALIAS_KWARG GraphQL::Language::Nodes::Field.new(field_alias: key(field_name), name: field_name) else GraphQL::Language::Nodes::Field.new(alias: key(field_name), name: field_name) end end |
.typename_node ⇒ Object
36 37 38 |
# File 'lib/graphql/stitching/export_selection.rb', line 36 def typename_node @typename_node ||= key_node("__typename") end |