Method: GraphQL::Language::SanitizedPrinter#print_argument

Defined in:
lib/graphql/language/sanitized_printer.rb


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/graphql/language/sanitized_printer.rb', line 75

def print_argument(argument)
  # We won't have type information if we're recursing into a custom scalar
  return super if @current_input_type && @current_input_type.kind.scalar?

  arg_owner = @current_input_type || @current_directive || @current_field
  old_current_argument = @current_argument
  @current_argument = arg_owner.get_argument(argument.name, @query.context)

  old_input_type = @current_input_type
  @current_input_type = @current_argument.type.non_null? ? @current_argument.type.of_type : @current_argument.type

  argument_value = if coerce_argument_value_to_list?(@current_input_type, argument.value)
    [argument.value]
  else
    argument.value
  end

  print_string("#{argument.name}: ")
  print_node(argument_value)

  @current_input_type = old_input_type
  @current_argument = old_current_argument
end