Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 614 Bytes

GraphQL-FieldHashKey.md

File metadata and controls

29 lines (20 loc) · 614 Bytes

Pattern: Missing use of :hash_key

Issue: -

Description

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

Examples

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

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

  def phone
    object[:home_phone]
  end
end

Further Reading