Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lint.rb « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f7796b1e9694d8d4b0eaf681f793ca4e43ee6515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module API
  class Lint < Grape::API::Instance
    namespace :ci do
      desc 'Validation of .gitlab-ci.yml content'
      params do
        requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
      end
      post '/lint' do
        error = Gitlab::Ci::YamlProcessor.validation_message(params[:content],
          user: current_user)

        status 200

        if error.blank?
          { status: 'valid', errors: [] }
        else
          { status: 'invalid', errors: [error] }
        end
      end
    end
  end
end