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
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.
234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/graphql/schema_comparator/changes.rb', line 234 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 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.
232 233 234 |
# File 'lib/graphql/schema_comparator/changes.rb', line 232 def criticality @criticality end |
#input_type ⇒ Object (readonly)
Returns the value of attribute input_type.
232 233 234 |
# File 'lib/graphql/schema_comparator/changes.rb', line 232 def input_type @input_type end |
#new_input_field ⇒ Object (readonly)
Returns the value of attribute new_input_field.
232 233 234 |
# File 'lib/graphql/schema_comparator/changes.rb', line 232 def new_input_field @new_input_field end |
#old_input_field ⇒ Object (readonly)
Returns the value of attribute old_input_field.
232 233 234 |
# File 'lib/graphql/schema_comparator/changes.rb', line 232 def old_input_field @old_input_field end |
Instance Method Details
#message ⇒ Object
248 249 250 |
# File 'lib/graphql/schema_comparator/changes.rb', line 248 def "Input field `#{input_type}.#{old_input_field.name}` changed type from `#{old_input_field.type}` to `#{new_input_field.type}`" end |