Class: GraphQL::SchemaComparator::Changes::DirectiveArgumentAdded

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(directive, argument) ⇒ DirectiveArgumentAdded

Returns a new instance of DirectiveArgumentAdded.



1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/graphql/schema_comparator/changes.rb', line 1076

def initialize(directive, argument)
  @criticality = if argument.type.non_null?
    Changes::Criticality.breaking
  else
    Changes::Criticality.non_breaking
  end
  @directive = directive
  @argument = argument
end

Instance Attribute Details

#argumentObject (readonly)

Returns the value of attribute argument.



1074
1075
1076
# File 'lib/graphql/schema_comparator/changes.rb', line 1074

def argument
  @argument
end

#criticalityObject (readonly)

Returns the value of attribute criticality.



1074
1075
1076
# File 'lib/graphql/schema_comparator/changes.rb', line 1074

def criticality
  @criticality
end

#directiveObject (readonly)

Returns the value of attribute directive.



1074
1075
1076
# File 'lib/graphql/schema_comparator/changes.rb', line 1074

def directive
  @directive
end

Instance Method Details

#messageObject



1086
1087
1088
# File 'lib/graphql/schema_comparator/changes.rb', line 1086

def message
  "Argument `#{argument.graphql_name}` was added to directive `#{directive.graphql_name}`"
end

#pathObject



1090
1091
1092
# File 'lib/graphql/schema_comparator/changes.rb', line 1090

def path
  ["@#{directive.graphql_name}", argument.graphql_name].join('.')
end