class GraphQL::SchemaComparator::Changes::FieldArgumentTypeChanged

Attributes

criticality[R]
field[R]
new_argument[R]
old_argument[R]
type[R]

Public Class Methods

new(type, field, old_argument, new_argument) click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 345
def initialize(type, field, old_argument, new_argument)
  if safe_change_for_input_value?(old_argument.type, new_argument.type)
    @criticality = Changes::Criticality.non_breaking(
      reason: "Changing an input field from non-null to null is considered non-breaking"
    )
  else
    @criticality = Changes::Criticality.breaking(
      reason: "Changing the type of a field's argument can cause existing queries that use this argument to error."
    )
  end

  @type = type
  @field = field
  @old_argument = old_argument
  @new_argument = new_argument
end

Public Instance Methods

message() click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 362
def message
  "Type for argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.graphql_definition.name}` changed"\
    " from `#{old_argument.type.graphql_definition}` to `#{new_argument.type.graphql_definition}`"
end
path() click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 367
def path
  [type.graphql_definition, field.graphql_definition.name, old_argument.graphql_name].join('.')
end