Class: GraphQL::SchemaComparator::Changes::EnumValueAdded

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) ⇒ EnumValueAdded


395
396
397
398
399
400
401
402
# File 'lib/graphql/schema_comparator/changes.rb', line 395

def initialize(enum_type, enum_value)
  @enum_type = enum_type
  @enum_value = enum_value
  @criticality = Changes::Criticality.dangerous(
    reason: "Adding an enum value may break existing clients that were not " \
      "programming defensively against an added case when querying an enum."
  )
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality


393
394
395
# File 'lib/graphql/schema_comparator/changes.rb', line 393

def criticality
  @criticality
end

#enum_typeObject (readonly)

Returns the value of attribute enum_type


393
394
395
# File 'lib/graphql/schema_comparator/changes.rb', line 393

def enum_type
  @enum_type
end

#enum_valueObject (readonly)

Returns the value of attribute enum_value


393
394
395
# File 'lib/graphql/schema_comparator/changes.rb', line 393

def enum_value
  @enum_value
end

Instance Method Details

#messageObject


404
405
406
# File 'lib/graphql/schema_comparator/changes.rb', line 404

def message
  "Enum value `#{enum_value.name}` was added to enum `#{enum_type.name}`"
end