Class: GraphQL::SchemaComparator::Changes::EnumValueAdded
- Inherits:
-
AbstractChange
- Object
- AbstractChange
- GraphQL::SchemaComparator::Changes::EnumValueAdded
- Defined in:
- lib/graphql/schema_comparator/changes.rb
Instance Attribute Summary collapse
-
#criticality ⇒ Object
readonly
Returns the value of attribute criticality.
-
#enum_type ⇒ Object
readonly
Returns the value of attribute enum_type.
-
#enum_value ⇒ Object
readonly
Returns the value of attribute enum_value.
Instance Method Summary collapse
-
#initialize(enum_type, enum_value, usage) ⇒ EnumValueAdded
constructor
A new instance of EnumValueAdded.
- #message ⇒ Object
- #path ⇒ Object
Methods inherited from AbstractChange
#breaking?, #dangerous?, #non_breaking?
Constructor Details
#initialize(enum_type, enum_value, usage) ⇒ EnumValueAdded
Returns a new instance of EnumValueAdded.
562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/graphql/schema_comparator/changes.rb', line 562 def initialize(enum_type, enum_value, usage) @enum_type = enum_type @enum_value = enum_value @criticality = if usage.output? Changes::Criticality.dangerous( reason: "Adding an enum value may break existing clients that were not " \ "programmed defensively against an added case when querying an enum." ) else Changes::Criticality.non_breaking( reason: "Adding an enum value for enums used only in inputs is non-breaking." ) end end |
Instance Attribute Details
#criticality ⇒ Object (readonly)
Returns the value of attribute criticality.
560 561 562 |
# File 'lib/graphql/schema_comparator/changes.rb', line 560 def criticality @criticality end |
#enum_type ⇒ Object (readonly)
Returns the value of attribute enum_type.
560 561 562 |
# File 'lib/graphql/schema_comparator/changes.rb', line 560 def enum_type @enum_type end |
#enum_value ⇒ Object (readonly)
Returns the value of attribute enum_value.
560 561 562 |
# File 'lib/graphql/schema_comparator/changes.rb', line 560 def enum_value @enum_value end |
Instance Method Details
#message ⇒ Object
577 578 579 |
# File 'lib/graphql/schema_comparator/changes.rb', line 577 def "Enum value `#{enum_value.graphql_name}` was added to enum `#{enum_type.graphql_name}`" end |
#path ⇒ Object
581 582 583 |
# File 'lib/graphql/schema_comparator/changes.rb', line 581 def path enum_value.path end |