Class: GraphQL::SchemaComparator::Changes::RootOperationTypeRemoved

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(old_schema:, operation_type:) ⇒ RootOperationTypeRemoved

Returns a new instance of RootOperationTypeRemoved.



268
269
270
271
272
# File 'lib/graphql/schema_comparator/changes.rb', line 268

def initialize(old_schema:, operation_type:)
  @old_schema = old_schema
  @operation_type = operation_type
  @criticality = Changes::Criticality.breaking
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality.



266
267
268
# File 'lib/graphql/schema_comparator/changes.rb', line 266

def criticality
  @criticality
end

#old_schemaObject (readonly)

Returns the value of attribute old_schema.



266
267
268
# File 'lib/graphql/schema_comparator/changes.rb', line 266

def old_schema
  @old_schema
end

#operation_typeObject (readonly)

Returns the value of attribute operation_type.



266
267
268
# File 'lib/graphql/schema_comparator/changes.rb', line 266

def operation_type
  @operation_type
end

Instance Method Details

#messageObject



274
275
276
# File 'lib/graphql/schema_comparator/changes.rb', line 274

def message
  "Schema #{operation_type} root `#{operation_type_name}` was removed"
end

#operation_type_nameObject



282
283
284
285
286
287
288
289
290
291
# File 'lib/graphql/schema_comparator/changes.rb', line 282

def operation_type_name
  case operation_type
    when :query
      old_schema.query.graphql_name
    when :mutation
      old_schema.mutation.graphql_name
    when :subscription
      old_schema.subscription.graphql_name
  end
end

#pathObject



278
279
280
# File 'lib/graphql/schema_comparator/changes.rb', line 278

def path
  operation_type_name
end