You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: fragment_types_exist.rb
    path of file: ./repos/graphql-ruby/lib/graphql/static_validation/rules
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
module GraphQL
 
    
      def validate_type_exists(fragment_node)
        if !fragment_node.type
          true
        else
          type_name = fragment_node.type.name
          type = context.warden.get_type(type_name)
          if type.nil?
            add_error(GraphQL::StaticValidation::FragmentTypesExistError.new(
              "No such type #{type_name}, so it can't be a fragment condition",
              nodes: fragment_node,
              type: type_name
            ))
            false
          else
            true
          end