Class: GraphQL::SchemaComparator::Changes::InputFieldTypeChanged
- Inherits:
-
AbstractChange
- Object
- AbstractChange
- GraphQL::SchemaComparator::Changes::InputFieldTypeChanged
- Includes:
- SafeTypeChange
- Defined in:
- lib/graphql/schema_comparator/changes.rb
Instance Attribute Summary collapse
-
#criticality ⇒ Object
readonly
Returns the value of attribute criticality.
-
#input_type ⇒ Object
readonly
Returns the value of attribute input_type.
-
#new_input_field ⇒ Object
readonly
Returns the value of attribute new_input_field.
-
#old_input_field ⇒ Object
readonly
Returns the value of attribute old_input_field.
Instance Method Summary collapse
-
#initialize(input_type, old_input_field, new_input_field) ⇒ InputFieldTypeChanged
constructor
A new instance of InputFieldTypeChanged.
- #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(input_type, old_input_field, new_input_field) ⇒ InputFieldTypeChanged
Returns a new instance of InputFieldTypeChanged.
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/graphql/schema_comparator/changes.rb', line 393 def initialize(input_type, old_input_field, new_input_field) if safe_change_for_input_value?(old_input_field.type, new_input_field.type) @criticality = Changes::Criticality.non_breaking( reason: "Changing an input field from non-null to null is considered non-breaking" ) else @criticality = Changes::Criticality.breaking( reason: "Changing the type of an input field can cause existing queries that use this field to error." ) end @input_type = input_type @old_input_field = old_input_field @new_input_field = new_input_field end |
Instance Attribute Details
#criticality ⇒ Object (readonly)
Returns the value of attribute criticality.
391 392 393 |
# File 'lib/graphql/schema_comparator/changes.rb', line 391 def criticality @criticality end |
#input_type ⇒ Object (readonly)
Returns the value of attribute input_type.
391 392 393 |
# File 'lib/graphql/schema_comparator/changes.rb', line 391 def input_type @input_type end |
#new_input_field ⇒ Object (readonly)
Returns the value of attribute new_input_field.
391 392 393 |
# File 'lib/graphql/schema_comparator/changes.rb', line 391 def new_input_field @new_input_field end |
#old_input_field ⇒ Object (readonly)
Returns the value of attribute old_input_field.
391 392 393 |
# File 'lib/graphql/schema_comparator/changes.rb', line 391 def old_input_field @old_input_field end |
Instance Method Details
#message ⇒ Object
409 410 411 |
# File 'lib/graphql/schema_comparator/changes.rb', line 409 def "Input field `#{path}` changed type from `#{old_input_field.type.to_type_signature}` to `#{new_input_field.type.to_type_signature}`" end |
#path ⇒ Object
413 414 415 |
# File 'lib/graphql/schema_comparator/changes.rb', line 413 def path old_input_field.path end |