File: commit.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (36 lines) | stat: -rw-r--r-- 1,965 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module API
  module Entities
    class Commit < Grape::Entity
      expose :id, documentation: { type: 'string', example: '2695effb5807a22ff3d138d593fd856244e155e7' }
      expose :short_id, documentation: { type: 'string', example: '2695effb' }
      expose :created_at, documentation: { type: 'dateTime', example: '2017-07-26T11:08:53.000+02:00' }
      expose :parent_ids,
        documentation: { type: 'string', is_array: true, example: '2a4b78934375d7f53875269ffd4f45fd83a84ebe' }
      expose :full_title, as: :title, documentation: { type: 'string', example: 'Initial commit' }
      expose :safe_message, as: :message, documentation: { type: 'string', example: 'Initial commit' }
      expose :author_name, documentation: { type: 'string', example: 'John Smith' }
      expose :author_email, documentation: { type: 'string', example: 'john@example.com' }
      expose :authored_date, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' }
      expose :committer_name, documentation: { type: 'string', example: 'Jack Smith' }
      expose :committer_email, documentation: { type: 'string', example: 'jack@example.com' }
      expose :committed_date, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' }
      expose :trailers, documentation: { type: 'object', example: '{ "Merged-By": "Jane Doe janedoe@gitlab.com" }' }
      expose :extended_trailers, documentation: {
        type: 'object',
        example: '{ "Signed-off-by": ["John Doe <johndoe@gitlab.com>", "Jane Doe <janedoe@gitlab.com>"] }'
      }

      expose :web_url,
        documentation: {
          type: 'string',
          example: 'https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746'
        } do |commit, _options|
        c = commit
        c = c.__subject__ if c.is_a?(Gitlab::View::Presenter::Base)
        Gitlab::UrlBuilder.build(c)
      end
    end
  end
end