BigW Consortium Gitlab

lint.rb 499 Bytes
Newer Older
1 2
module API
  class Lint < Grape::API
Katarzyna Kobierska committed
3
    namespace :ci do
4 5 6 7
      desc 'Validation of .gitlab-ci.yml content'
      params do
        requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
      end
Katarzyna Kobierska committed
8
      post '/lint' do
9
        error = Gitlab::Ci::YamlProcessor.validation_message(params[:content])
10

Katarzyna Kobierska committed
11
        status 200
Katarzyna Kobierska committed
12

13
        if error.blank?
Katarzyna Kobierska committed
14 15
          { status: 'valid', errors: [] }
        else
16
          { status: 'invalid', errors: [error] }
Katarzyna Kobierska committed
17 18
        end
      end
19 20 21
    end
  end
end