Class: GraphQL::SchemaComparator::Changes::ObjectTypeInterfaceAdded

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(interface, object_type) ⇒ ObjectTypeInterfaceAdded

Returns a new instance of ObjectTypeInterfaceAdded.



610
611
612
613
614
615
616
617
# File 'lib/graphql/schema_comparator/changes.rb', line 610

def initialize(interface, object_type)
  @criticality = Changes::Criticality.dangerous(
    reason: "Adding an interface to an object type may break existing clients " \
      "that were not programming defensively against a new possible type."
  )
  @interface = interface
  @object_type = object_type
end

Instance Attribute Details

#criticalityObject (readonly)

Returns the value of attribute criticality.



608
609
610
# File 'lib/graphql/schema_comparator/changes.rb', line 608

def criticality
  @criticality
end

#interfaceObject (readonly)

Returns the value of attribute interface.



608
609
610
# File 'lib/graphql/schema_comparator/changes.rb', line 608

def interface
  @interface
end

#object_typeObject (readonly)

Returns the value of attribute object_type.



608
609
610
# File 'lib/graphql/schema_comparator/changes.rb', line 608

def object_type
  @object_type
end

Instance Method Details

#messageObject



619
620
621
# File 'lib/graphql/schema_comparator/changes.rb', line 619

def message
  "`#{object_type.graphql_name}` object implements `#{interface.graphql_name}` interface"
end

#pathObject



623
624
625
# File 'lib/graphql/schema_comparator/changes.rb', line 623

def path
  object_type.path
end