Class: GraphQL::SchemaComparator::Changes::FieldArgumentDefaultChanged

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

Overview

Dangerous Changes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractChange

#breaking?, #dangerous?, #non_breaking?

Constructor Details

#initialize(type, field, old_argument, new_argument) ⇒ FieldArgumentDefaultChanged


337
338
339
340
341
342
343
344
345
346
# File 'lib/graphql/schema_comparator/changes.rb', line 337

def initialize(type, field, old_argument, new_argument)
  @type = type
  @field = field
  @old_argument = old_argument
  @new_argument = new_argument
  @criticality = Changes::Criticality.dangerous(
    reason: "Changing the default value for an argument may change the runtime " \
      "behaviour of a field if it was never provided."
  )
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality


335
336
337
# File 'lib/graphql/schema_comparator/changes.rb', line 335

def criticality
  @criticality
end

#fieldObject (readonly)

Returns the value of attribute field


335
336
337
# File 'lib/graphql/schema_comparator/changes.rb', line 335

def field
  @field
end

#new_argumentObject (readonly)

Returns the value of attribute new_argument


335
336
337
# File 'lib/graphql/schema_comparator/changes.rb', line 335

def new_argument
  @new_argument
end

#old_argumentObject (readonly)

Returns the value of attribute old_argument


335
336
337
# File 'lib/graphql/schema_comparator/changes.rb', line 335

def old_argument
  @old_argument
end

#typeObject (readonly)

Returns the value of attribute type


335
336
337
# File 'lib/graphql/schema_comparator/changes.rb', line 335

def type
  @type
end

Instance Method Details

#messageObject


348
349
350
351
# File 'lib/graphql/schema_comparator/changes.rb', line 348

def message
  "Default value for argument `#{new_argument.name}` on field `#{type.name}.#{field.name}` changed"\
    " from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
end