Class: GraphQL::SchemaComparator::Changes::FieldTypeChanged

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SafeTypeChange

#safe_change_for_field?, #safe_change_for_input_value?

Methods inherited from AbstractChange

#breaking?, #dangerous?, #non_breaking?

Constructor Details

#initialize(type, old_field, new_field) ⇒ FieldTypeChanged


210
211
212
213
214
# File 'lib/graphql/schema_comparator/changes.rb', line 210

def initialize(type, old_field, new_field)
  @type = type
  @old_field = old_field
  @new_field = new_field
end

Instance Attribute Details

#new_fieldObject (readonly)

Returns the value of attribute new_field


208
209
210
# File 'lib/graphql/schema_comparator/changes.rb', line 208

def new_field
  @new_field
end

#old_fieldObject (readonly)

Returns the value of attribute old_field


208
209
210
# File 'lib/graphql/schema_comparator/changes.rb', line 208

def old_field
  @old_field
end

#typeObject (readonly)

Returns the value of attribute type


208
209
210
# File 'lib/graphql/schema_comparator/changes.rb', line 208

def type
  @type
end

Instance Method Details

#criticalityObject


220
221
222
223
224
225
226
# File 'lib/graphql/schema_comparator/changes.rb', line 220

def criticality
  if safe_change_for_field?(old_field.type, new_field.type)
    Changes::Criticality.non_breaking
  else
    Changes::Criticality.breaking
  end
end

#messageObject


216
217
218
# File 'lib/graphql/schema_comparator/changes.rb', line 216

def message
  "Field `#{type}.#{old_field.name}` changed type from `#{old_field.type}` to `#{new_field.type}`"
end