class GraphQL::SchemaComparator::Changes::InputFieldTypeChanged

Attributes

criticality[R]
input_type[R]
new_input_field[R]
old_input_field[R]

Public Class Methods

new(input_type, old_input_field, new_input_field) click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 315
def initialize(input_type, old_input_field, new_input_field)
  if safe_change_for_input_value?(old_input_field.type, new_input_field.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 an input field can cause existing queries that use this field to error."
    )
  end

  @input_type = input_type
  @old_input_field = old_input_field
  @new_input_field = new_input_field
end

Public Instance Methods

message() click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 331
def message
  "Input field `#{input_type.graphql_definition}.#{old_input_field.graphql_name}` changed type from `#{old_input_field.type.graphql_definition}` to `#{new_input_field.type.graphql_definition}`"
end
path() click to toggle source
# File lib/graphql/schema_comparator/changes.rb, line 335
def path
  [input_type.graphql_definition, old_input_field.graphql_name].join('.')
end