Module: GraphQL::Schema::Member::HasArguments::FieldConfigured Private

Included in:
Field
Defined in:
lib/graphql/schema/member/has_arguments.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#all_argument_definitionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/graphql/schema/member/has_arguments.rb', line 194

def all_argument_definitions
  if defined?(@resolver_class) && @resolver_class
    all_defns = {}
    @resolver_class.all_field_argument_definitions.each do |arg_defn|
      key = arg_defn.graphql_name
      case (current_value = all_defns[key])
      when nil
        all_defns[key] = arg_defn
      when Array
        current_value << arg_defn
      when GraphQL::Schema::Argument
        all_defns[key] = [current_value, arg_defn]
      else
        raise "Invariant: Unexpected argument definition, #{current_value.class}: #{current_value.inspect}"
      end
    end
    all_defns.merge!(own_arguments)
    all_defns = all_defns.values
    all_defns.flatten!
    all_defns
  else
    super
  end
end

#arguments(context = GraphQL::Query::NullContext) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/graphql/schema/member/has_arguments.rb', line 176

def arguments(context = GraphQL::Query::NullContext)
  own_arguments = super
  if defined?(@resolver_class) && @resolver_class
    inherited_arguments = @resolver_class.field_arguments(context)
    if own_arguments.any?
      if inherited_arguments.any?
        inherited_arguments.merge(own_arguments)
      else
        own_arguments
      end
    else
      inherited_arguments
    end
  else
    own_arguments
  end
end