gitlab-org--gitlab-foss/lib/api/lint.rb

22 lines
499 B
Ruby
Raw Normal View History

2016-08-24 09:42:48 +00:00
module API
class Lint < Grape::API
2016-08-30 13:38:36 +00:00
namespace :ci do
2016-09-07 10:19:36 +00:00
desc 'Validation of .gitlab-ci.yml content'
params do
requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
end
2016-08-30 11:03:29 +00:00
post '/lint' do
error = Gitlab::Ci::YamlProcessor.validation_message(params[:content])
2016-08-30 11:03:29 +00:00
status 200
2016-08-29 13:07:19 +00:00
2016-08-31 09:16:25 +00:00
if error.blank?
2016-08-30 11:03:29 +00:00
{ status: 'valid', errors: [] }
else
2016-08-31 09:16:25 +00:00
{ status: 'invalid', errors: [error] }
2016-08-30 11:03:29 +00:00
end
end
2016-08-24 09:42:48 +00:00
end
end
end