class GraphqlRails::Model::BuildGraphqlInputType

stores information about model specific config, like attributes and types

Attributes

attributes[R]
description[R]
model_configuration[R]
name[R]

Public Class Methods

inspect() click to toggle source
# File lib/graphql_rails/model/build_graphql_input_type.rb, line 30
def self.inspect
  "#{GraphQL::Schema::InputObject}(#{graphql_name})"
end
new(name:, description: nil, attributes:) click to toggle source
# File lib/graphql_rails/model/build_graphql_input_type.rb, line 11
def initialize(name:, description: nil, attributes:)
  @name = name
  @attributes = attributes
  @description = description
end

Public Instance Methods

call() click to toggle source
# File lib/graphql_rails/model/build_graphql_input_type.rb, line 17
def call
  type_name = name
  type_description = description
  type_attributes = attributes

  Class.new(GraphQL::Schema::InputObject) do
    graphql_name(type_name)
    description(type_description)

    type_attributes.each_value do |type_attribute|
      argument(*type_attribute.input_argument_args, **type_attribute.input_argument_options)
    end

    def self.inspect
      "#{GraphQL::Schema::InputObject}(#{graphql_name})"
    end
  end
end