Class: GraphQL::SchemaComparator::Changes::FieldRemoved

Inherits:
AbstractChange
  • Object
show all
Defined in:
lib/graphql/schema_comparator/changes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractChange

#breaking?, #dangerous?, #non_breaking?

Constructor Details

#initialize(object_type, field) ⇒ FieldRemoved

Returns a new instance of FieldRemoved.



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/graphql/schema_comparator/changes.rb', line 297

def initialize(object_type, field)
  @object_type = object_type
  @field = field

  if field.deprecation_reason
    @criticality = Changes::Criticality.breaking(
      reason: "Removing a deprecated field is a breaking change. Before removing it, you may want" \
        "to look at the field's usage to see the impact of removing the field."
    )
  else
    @criticality = Changes::Criticality.breaking(
      reason: "Removing a field is a breaking change. It is preferable to deprecate the field before removing it."
    )
  end
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality.



295
296
297
# File 'lib/graphql/schema_comparator/changes.rb', line 295

def criticality
  @criticality
end

#fieldObject (readonly)

Returns the value of attribute field.



295
296
297
# File 'lib/graphql/schema_comparator/changes.rb', line 295

def field
  @field
end

#object_typeObject (readonly)

Returns the value of attribute object_type.



295
296
297
# File 'lib/graphql/schema_comparator/changes.rb', line 295

def object_type
  @object_type
end

Instance Method Details

#messageObject



313
314
315
# File 'lib/graphql/schema_comparator/changes.rb', line 313

def message
  "Field `#{field.graphql_name}` was removed from object type `#{object_type.graphql_name}`"
end

#pathObject



317
318
319
# File 'lib/graphql/schema_comparator/changes.rb', line 317

def path
  [object_type.graphql_name, field.graphql_name].join(".")
end