Method: GraphQL::Schema::Field#scoped?

Defined in:
lib/graphql/schema/field.rb

#scoped?Boolean

Returns if true, the return type's .scope_items method will be applied to this field's return value.

Returns:

  • (Boolean)

    if true, the return type's .scope_items method will be applied to this field's return value



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/graphql/schema/field.rb', line 137

def scoped?
  if !@scope.nil?
    # The default was overridden
    @scope
  elsif @return_type_expr
    # Detect a list return type, but don't call `type` since that may eager-load an otherwise lazy-loaded type
    @return_type_expr.is_a?(Array) ||
      (@return_type_expr.is_a?(String) && @return_type_expr.include?("[")) ||
      connection?
  elsif @resolver_class
    resolver_type = @resolver_class.type_expr
    resolver_type.is_a?(Array) ||
      (resolver_type.is_a?(String) && resolver_type.include?("[")) ||
      connection?
  else
    false
  end
end