Class: GraphQL::Stitching::Shaper
- Inherits:
-
Object
- Object
- GraphQL::Stitching::Shaper
- Defined in:
- lib/graphql/stitching/shaper.rb
Overview
Shapes the final results payload to the request selection and schema definition. This eliminates unrequested export selections and applies null bubbling.
Instance Method Summary collapse
-
#initialize(request) ⇒ Shaper
constructor
A new instance of Shaper.
- #perform!(raw) ⇒ Object
Constructor Details
#initialize(request) ⇒ Shaper
Returns a new instance of Shaper.
9 10 11 12 13 |
# File 'lib/graphql/stitching/shaper.rb', line 9 def initialize(request) @request = request @supergraph = request.supergraph @root_type = nil end |
Instance Method Details
#perform!(raw) ⇒ Object
15 16 17 18 |
# File 'lib/graphql/stitching/shaper.rb', line 15 def perform!(raw) @root_type = @supergraph.schema.root_type_for_operation(@request.operation.operation_type) resolve_object_scope(raw, @root_type, @request.operation.selections, @root_type.graphql_name) end |