module GraphQL::Client::Schema::ClassMethods

def define_class(definition, ast_nodes, type)

def define_class(definition, ast_nodes, type)
  type_class = case type.kind.name
  when "NON_NULL"
    define_class(definition, ast_nodes, type.of_type).to_non_null_type
  when "LIST"
    define_class(definition, ast_nodes, type.of_type).to_list_type
  else
    get_class(type.graphql_name).define_class(definition, ast_nodes)
  end
  ast_nodes.each do |ast_node|
    ast_node.directives.each do |directive|
      if directive = self.directives[directive.name.to_sym]
        type_class = directive.new(type_class)
      end
    end
  end
  type_class
end