Class: GraphQL::SchemaComparator::Changes::EnumValueRemoved

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(enum_type, enum_value, usage) ⇒ EnumValueRemoved

Returns a new instance of EnumValueRemoved.



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/graphql/schema_comparator/changes.rb', line 102

def initialize(enum_type, enum_value, usage)
  @enum_value = enum_value
  @enum_type = enum_type
  @criticality = if usage.input?
                   Changes::Criticality.breaking(
                     reason: "Removing an enum value will cause existing queries that use this enum value to error."
                   )
                 else
                   Changes::Criticality.non_breaking(
                     reason: "Removing an enum value for enums used only in outputs is non-breaking."
                   )
                 end
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality.



100
101
102
# File 'lib/graphql/schema_comparator/changes.rb', line 100

def criticality
  @criticality
end

#enum_typeObject (readonly)

Returns the value of attribute enum_type.



100
101
102
# File 'lib/graphql/schema_comparator/changes.rb', line 100

def enum_type
  @enum_type
end

#enum_valueObject (readonly)

Returns the value of attribute enum_value.



100
101
102
# File 'lib/graphql/schema_comparator/changes.rb', line 100

def enum_value
  @enum_value
end

Instance Method Details

#messageObject



116
117
118
# File 'lib/graphql/schema_comparator/changes.rb', line 116

def message
  "Enum value `#{enum_value.graphql_name}` was removed from enum `#{enum_type.graphql_name}`"
end

#pathObject



120
121
122
# File 'lib/graphql/schema_comparator/changes.rb', line 120

def path
  enum_value.path
end