def field_ast(field, arguments = {}, &blk)
      type = field.type.unwrap

      # Bail unless we have the required arguments.
      required_args_are_present = field.arguments.all? do |arg_name, arg|
        arguments.key?(arg_name) || valid_input?(arg.type, nil)
      end

      if !required_args_are_present
        nil
      else
        f_alias = field.name == 'id' ? nil : random_alias
        f_args = arguments.map do |name, value|
          GraphQL::Language::Nodes::Argument.new(name: name, value: value)
        end

        GraphQL::Language::Nodes::Field.new(name: field.name, alias: f_alias, arguments: f_args)
      end
    end
def field_ast(field, arguments = {}, &blk)
      type = field.type.unwrap

      # Bail unless we have the required arguments.
      required_args_are_present = field.arguments.all? do |arg_name, arg|
        arguments.key?(arg_name) || valid_input?(arg.type, nil)
      end

      if !required_args_are_present
        nil
      else
        f_alias = field.name == 'id' ? nil : random_alias
        f_args = arguments.map do |name, value|
          GraphQL::Language::Nodes::Argument.new(name: name, value: value)
        end

        GraphQL::Language::Nodes::Field.new(name: field.name, alias: f_alias, arguments: f_args)
      end
    end
Make a field AST.

 field     - The GraphQL::Field instance to make the fragment for.
 arguments - A Hash of arguments to include in the field.
 &blk      - A block to call with the AST and field type before returning
             the AST.

 Returns a GraphQL::Language::Nodes::Field instance or nil if the created
 AST was invalid for having no selections or missing required arguments.