@@ -21,10 +21,20 @@ class Composer
2121 end
2222
2323 # @api private
24- BASIC_VALUE_MERGER = -> ( values_by_location , _info ) { values_by_location . values . find { !_1 . nil? } }
24+ BASIC_VALUE_MERGER = -> ( values_by_location , _info ) { values_by_location . each_value . find { !_1 . nil? } }
2525
2626 # @api private
27- VISIBILITY_PROFILES_MERGER = -> ( values_by_location , _info ) { values_by_location . values . reduce ( :& ) }
27+ VISIBILITY_PROFILES_MERGER = -> ( values_by_location , _info ) { values_by_location . each_value . reduce ( :& ) }
28+
29+ # @api private
30+ # VISIBILITY_PROFILES_MERGER = begin
31+ # f = Class.new(Formatter) do
32+ # def merge_kwargs(values_by_location, _info)
33+ # values_by_location.each_value.reduce(:&)
34+ # end
35+ # end
36+ # f.new
37+ # end
2838
2939 # @api private
3040 COMPOSITION_VALIDATORS = [
@@ -52,22 +62,22 @@ def initialize(
5262 mutation_name : "Mutation" ,
5363 subscription_name : "Subscription" ,
5464 visibility_profiles : [ ] ,
55- description_merger : nil ,
5665 deprecation_merger : nil ,
5766 default_value_merger : nil ,
5867 directive_kwarg_merger : nil ,
5968 root_field_location_selector : nil ,
60- root_entrypoints : nil
69+ root_entrypoints : nil ,
70+ formatter : nil
6171 )
6272 @query_name = query_name
6373 @mutation_name = mutation_name
6474 @subscription_name = subscription_name
65- @description_merger = description_merger || BASIC_VALUE_MERGER
6675 @deprecation_merger = deprecation_merger || BASIC_VALUE_MERGER
6776 @default_value_merger = default_value_merger || BASIC_VALUE_MERGER
6877 @directive_kwarg_merger = directive_kwarg_merger || BASIC_VALUE_MERGER
6978 @root_field_location_selector = root_field_location_selector
7079 @root_entrypoints = root_entrypoints || { }
80+ @formatter = formatter || Formatter . new
7181
7282 @field_map = { }
7383 @resolver_map = { }
@@ -537,12 +547,12 @@ def merge_value_types(type_name, subgraph_types, field_name: nil, argument_name:
537547 # @!visibility private
538548 def merge_descriptions ( type_name , members_by_location , field_name : nil , argument_name : nil , enum_value : nil )
539549 strings_by_location = members_by_location . each_with_object ( { } ) { |( l , m ) , memo | memo [ l ] = m . description }
540- @description_merger . call ( strings_by_location , {
550+ @formatter . merge_descriptions ( strings_by_location , Formatter :: Info . new (
541551 type_name : type_name ,
542552 field_name : field_name ,
543553 argument_name : argument_name ,
544554 enum_value : enum_value ,
545- } . tap ( & :compact! ) )
555+ ) )
546556 end
547557
548558 # @!scope class
0 commit comments