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 selection hints and applies null bubbling.
Instance Method Summary collapse
-
#initialize(supergraph:, request:) ⇒ Shaper
constructor
A new instance of Shaper.
- #perform!(raw) ⇒ Object
Constructor Details
#initialize(supergraph:, request:) ⇒ Shaper
Returns a new instance of Shaper.
9 10 11 12 |
# File 'lib/graphql/stitching/shaper.rb', line 9 def initialize(supergraph:, request:) @supergraph = supergraph @request = request end |
Instance Method Details
#perform!(raw) ⇒ Object
14 15 16 17 |
# File 'lib/graphql/stitching/shaper.rb', line 14 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 |