Class: GraphQL::SchemaComparator::Changes::TypeKindChanged

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(old_type, new_type) ⇒ TypeKindChanged

Returns a new instance of TypeKindChanged.



82
83
84
85
86
87
88
# File 'lib/graphql/schema_comparator/changes.rb', line 82

def initialize(old_type, new_type)
  @old_type = old_type
  @new_type = new_type
  @criticality = Changes::Criticality.breaking(
    reason: "Changing the kind of a type is a breaking change because it can cause existing queries to error. For example, turning an object type to a scalar type would break queries that define a selection set for this type."
  )
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality.



80
81
82
# File 'lib/graphql/schema_comparator/changes.rb', line 80

def criticality
  @criticality
end

#new_typeObject (readonly)

Returns the value of attribute new_type.



80
81
82
# File 'lib/graphql/schema_comparator/changes.rb', line 80

def new_type
  @new_type
end

#old_typeObject (readonly)

Returns the value of attribute old_type.



80
81
82
# File 'lib/graphql/schema_comparator/changes.rb', line 80

def old_type
  @old_type
end

Instance Method Details

#messageObject



90
91
92
# File 'lib/graphql/schema_comparator/changes.rb', line 90

def message
  "`#{old_type.graphql_name}` kind changed from `#{old_type.kind}` to `#{new_type.kind}`"
end

#pathObject



94
95
96
# File 'lib/graphql/schema_comparator/changes.rb', line 94

def path
  old_type.path
end