Skip to content

Files

Latest commit

 

History

History
29 lines (20 loc) · 603 Bytes

GraphQL-FieldMethod.md

File metadata and controls

29 lines (20 loc) · 603 Bytes

Pattern: Missing use of :method

Issue: -

Description

Prevents defining unnecessary resolver methods in cases when :method option can be used.

Examples

# good
class Types::UserType < Types::BaseObject
  field :phone, String, null: true, method: :home_phone
end

# bad
class Types::UserType < Types::BaseObject
  field :phone, String, null: true

  def phone
    object.home_phone
  end
end

Further Reading