Class: GraphQL::SchemaComparator::Diff::DirectiveArgument

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

Instance Method Summary collapse

Constructor Details

#initialize(directive, old_arg, new_arg) ⇒ DirectiveArgument

Returns a new instance of DirectiveArgument.



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

def initialize(directive, old_arg, new_arg)
  @directive = directive
  @old_arg = old_arg
  @new_arg = new_arg
end

Instance Method Details

#diffObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/graphql/schema_comparator/diff/directive_argument.rb', line 11

def diff
  changes = []

  if old_arg.description != new_arg.description
    changes << Changes::DirectiveArgumentDescriptionChanged.new(directive, old_arg, new_arg)
  end

  if old_arg.default_value != new_arg.default_value
    changes << Changes::DirectiveArgumentDefaultChanged.new(directive, old_arg, new_arg)
  end

  if old_arg.type.to_type_signature != new_arg.type.to_type_signature
    changes << Changes::DirectiveArgumentTypeChanged.new(directive, old_arg, new_arg)
  end

  # TODO directives on directive arguments

  changes
end