Class: SolidusGraphqlApi::Types::Base::Object

Inherits:
GraphQL::Schema::Object
  • Object
show all
Defined in:
lib/solidus_graphql_api/types/base/object.rb

Direct Known Subclasses

RelayNode, ManifestItem, Mutation, Query, UserError

Class Method Summary collapse

Class Method Details

.remove_field(field) ⇒ Object

Removes a field from this schema.

Examples:

Removing a field in a decorator

Spree::Graphql::Types::Variant.remove_field :prices

Parameters:

  • field (Symbol)

    the field to remove



14
15
16
17
18
19
20
# File 'lib/solidus_graphql_api/types/base/object.rb', line 14

def remove_field(field)
  unless own_fields.key?(field.to_s)
    raise ArgumentError, "Field `#{field}` is not defined"
  end

  own_fields.delete(field.to_s)
end