Class: GraphQL::SchemaComparator::Diff::InputObject

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

Instance Method Summary collapse

Constructor Details

#initialize(old_type, new_type) ⇒ InputObject

Returns a new instance of InputObject.



5
6
7
8
9
10
11
# File 'lib/graphql/schema_comparator/diff/input_object.rb', line 5

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

  @old_fields = old_type.arguments
  @new_fields = new_type.arguments
end

Instance Method Details

#diffObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/graphql/schema_comparator/diff/input_object.rb', line 13

def diff
  changes = []

  changes += removed_fields.map { |field| Changes::InputFieldRemoved.new(old_type, field) }
  changes += added_fields.map { |field| Changes::InputFieldAdded.new(new_type, field) }

  each_common_field do |old_field, new_field|
    # TODO: Add Directive Stuff
    changes += InputField.new(old_type, new_type, old_field, new_field).diff
  end

  changes
end