class GraphqlRails::Attributes::InputTypeParser

converts string value in to GraphQL type

Attributes

subtype[R]
unparsed_type[R]

Public Class Methods

new(unparsed_type, subtype:) click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 13
def initialize(unparsed_type, subtype:)
  @unparsed_type = unparsed_type
  @subtype = subtype
end

Public Instance Methods

graphql_type() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 18
def graphql_type
  return nil if unparsed_type.nil?

  partly_parsed_type || parsed_type
end
input_type_arg() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 24
def input_type_arg
  if list?
    list_type_arg
  else
    unwrapped_type
  end
end

Private Instance Methods

list_type_arg() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 46
def list_type_arg
  if required_inner_type?
    [unwrapped_type]
  else
    [unwrapped_type, null: true]
  end
end
raw_unwrapped_type() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 40
def raw_unwrapped_type
  return nil unless raw_graphql_type?

  unwrap_type(unparsed_type)
end
unwrapped_model_input_type() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 54
def unwrapped_model_input_type
  type_class = graphql_model
  return unless type_class

  type_class.graphql.input(subtype).graphql_input_type
end
unwrapped_type() click to toggle source
# File lib/graphql_rails/attributes/input_type_parser.rb, line 36
def unwrapped_type
  raw_unwrapped_type || unwrapped_scalar_type || unwrapped_model_input_type || raise_not_supported_type_error
end