json.total_count @tag_names.present? ? @tag_names.count : @tags.count
json.tags @tags do |tag|
  if tag.present? && tag.is_a?(Hash)
    json.name tag['name']
    json.id tag['id']
    json.zipball_url render_zip_url(@owner, @repository, tag['name'])
    json.tarball_url render_tar_url(@owner, @repository, tag['name'])
    json.tagger do 
      json.partial! 'commit_author', user: render_cache_commit_author(tag['tagger']), name: tag['tagger']['name']
    end
    json.time_ago time_from_now(tag['tagger']['date'].to_time)
    json.created_at_unix tag['tagger']['date'].to_time.to_i
    json.message tag['message']
    json.commit do
      json.sha tag['commit']['sha']
      json.message tag['commit']['message']
      json.time_ago time_from_now(tag['commit']['commiter']['date'].to_time)
      json.created_at_unix tag['commit']['commiter']['date'].to_time.to_i
      json.committer do 
        json.partial! 'commit_author', user: render_cache_commit_author(tag['commit']['commiter']), name: tag['commit']['commiter']['name']
      end
      json.author do 
        json.partial! 'commit_author', user: render_cache_commit_author(tag['commit']['author']), name: tag['commit']['author']['name']
      end
    end
  else 
    json.name tag
  end
end

