Shopify / rbi-central

MIT License
55 stars 36 forks source link

Fix GraphQL `HasFields#field` RBI #241

Closed amomchilov closed 4 months ago

amomchilov commented 4 months ago

Type of Change

Changes

GraphQL::Schema::HasFields#field supports an optional argument, in a way that makes both of these legal:

# From https://graphql-ruby.org/fields/arguments
field :search_posts, [PostType], null: false do
  # `argument` called on `self`, depends on the `.bind(GraphQL::Schema::Field)`
  argument :category, String
end

field :search_posts, [PostType], null: false do |field|
  # `argument` called on `field`, depends on the `.params(field: GraphQL::Schema::Field)`
  field.argument :category, String
end