def node_field_ast(field)
      f_ast = field_ast(field)
      return nil if f_ast.nil?
      type = field.type.unwrap
      selections = f_ast.selections.dup

      if type.kind.object?
        selections << field_ast(type.get_field('id'))
      else
        possible_node_types(type).each do |if_type|
          selections << inline_fragment_ast(if_type, with_children: false)
        end
      end

      selections.compact!

      if f_ast.respond_to?(:merge) # GraphQL-Ruby 1.9+
        f_ast = f_ast.merge(selections: selections)
      else
        f_ast.selections = selections
      end
      f_ast
    end
def node_field_ast(field)
      f_ast = field_ast(field)
      return nil if f_ast.nil?
      type = field.type.unwrap
      selections = f_ast.selections.dup

      if type.kind.object?
        selections << field_ast(type.get_field('id'))
      else
        possible_node_types(type).each do |if_type|
          selections << inline_fragment_ast(if_type, with_children: false)
        end
      end

      selections.compact!

      if f_ast.respond_to?(:merge) # GraphQL-Ruby 1.9+
        f_ast = f_ast.merge(selections: selections)
      else
        f_ast.selections = selections
      end
      f_ast
    end
Make a field AST for a node field.

 field - The GraphQL::Field instance to make the fragment for.

 Returns a GraphQL::Language::Nodes::Field instance.