Class: GraphQL::SchemaComparator::Diff::ObjectType

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema_comparator/diff/object_type.rb

Instance Method Summary collapse

Constructor Details

#initialize(old_type, new_type) ⇒ ObjectType


5
6
7
8
9
10
11
12
13
14
# File 'lib/graphql/schema_comparator/diff/object_type.rb', line 5

def initialize(old_type, new_type)
  @old_type = old_type
  @new_type = new_type

  @old_fields = old_type.fields
  @new_fields = new_type.fields

  @old_interfaces = old_type.interfaces
  @new_interfaces = new_type.interfaces
end

Instance Method Details

#diffObject


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/graphql/schema_comparator/diff/object_type.rb', line 16

def diff
  changes = []

  changes += interface_additions
  changes += interface_removals
  changes += field_removals
  changes += field_additions

  each_common_field do |old_field, new_field|
    changes += Diff::Field.new(old_type, new_type, old_field, new_field).diff
  end

  changes
end