docs/composer.md in graphql-stitching-0.3.2 vs docs/composer.md in graphql-stitching-0.3.3

- old
+ new

@@ -11,10 +11,11 @@ query_name: "Query", mutation_name: "Mutation", description_merger: ->(values_by_location, info) { values_by_location.values.join("\n") }, deprecation_merger: ->(values_by_location, info) { values_by_location.values.first }, directive_kwarg_merger: ->(values_by_location, info) { values_by_location.values.last }, + root_field_location_selector: ->(locations, info) { locations.last }, ) ``` Constructor arguments: @@ -26,15 +27,17 @@ - **`deprecation_merger:`** _optional_, a [value merger function](#value-merger-functions) for merging element deprecation strings from across locations. - **`directive_kwarg_merger:`** _optional_, a [value merger function](#value-merger-functions) for merging directive keyword arguments from across locations. +- **`root_field_location_selector:`** _optional_, selects a default routing location for root fields with multiple locations. Use this to prioritize sending root fields to their primary data sources (only applies while routing the root operation scope). This handler receives an array of possible locations and an info object with field information, and should return the prioritized location. The last location is used by default. + #### Value merger functions Static data values such as element descriptions and directive arguments must also merge across locations. By default, the first non-null value encountered for a given element attribute is used. A value merger function may customize this process by selecting a different value or computing a new one: ```ruby -supergraph = GraphQL::Stitching::Composer.new( +composer = GraphQL::Stitching::Composer.new( description_merger: ->(values_by_location, info) { values_by_location.values.compact.join("\n") }, ) ``` A merger function receives `values_by_location` and `info` arguments; these provide possible values keyed by location and info about where in the schema these values were encountered: