Class: GraphQL::SchemaComparator::Changes::FieldTypeChanged
- Inherits:
-
AbstractChange
- Object
- AbstractChange
- GraphQL::SchemaComparator::Changes::FieldTypeChanged
- Includes:
- SafeTypeChange
- Defined in:
- lib/graphql/schema_comparator/changes.rb
Instance Attribute Summary collapse
-
#new_field ⇒ Object
readonly
Returns the value of attribute new_field.
-
#old_field ⇒ Object
readonly
Returns the value of attribute old_field.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #criticality ⇒ Object
-
#initialize(type, old_field, new_field) ⇒ FieldTypeChanged
constructor
A new instance of FieldTypeChanged.
- #message ⇒ Object
- #path ⇒ Object
Methods included from SafeTypeChange
#safe_change_for_field?, #safe_change_for_input_value?
Methods inherited from AbstractChange
#breaking?, #dangerous?, #non_breaking?
Constructor Details
#initialize(type, old_field, new_field) ⇒ FieldTypeChanged
Returns a new instance of FieldTypeChanged.
365 366 367 368 369 |
# File 'lib/graphql/schema_comparator/changes.rb', line 365 def initialize(type, old_field, new_field) @type = type @old_field = old_field @new_field = new_field end |
Instance Attribute Details
#new_field ⇒ Object (readonly)
Returns the value of attribute new_field.
363 364 365 |
# File 'lib/graphql/schema_comparator/changes.rb', line 363 def new_field @new_field end |
#old_field ⇒ Object (readonly)
Returns the value of attribute old_field.
363 364 365 |
# File 'lib/graphql/schema_comparator/changes.rb', line 363 def old_field @old_field end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
363 364 365 |
# File 'lib/graphql/schema_comparator/changes.rb', line 363 def type @type end |
Instance Method Details
#criticality ⇒ Object
375 376 377 378 379 380 381 |
# File 'lib/graphql/schema_comparator/changes.rb', line 375 def criticality if safe_change_for_field?(old_field.type, new_field.type) Changes::Criticality.non_breaking else Changes::Criticality.breaking # TODO - Add reason end end |
#message ⇒ Object
371 372 373 |
# File 'lib/graphql/schema_comparator/changes.rb', line 371 def "Field `#{old_field.path}` changed type from `#{old_field.type.to_type_signature}` to `#{new_field.type.to_type_signature}`" end |
#path ⇒ Object
383 384 385 |
# File 'lib/graphql/schema_comparator/changes.rb', line 383 def path old_field.path end |