gitlab-org--gitlab-foss/lib/api/lint.rb
Katarzyna Kobierska 2c8b830fdb Code refactoring
2016-09-07 12:10:49 +02:00

26 lines
547 B
Ruby

module API
class Lint < Grape::API
desc 'Validation of .gitlab-ci.yml content'
params do
requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
end
post 'ci/lint' do
error = Ci::GitlabCiYamlProcessor.validation_message(params[:content])
response = {
status: '',
error: ''
}
if error.blank?
response[:status] = 'valid'
else
response[:error] = error
response[:status] = 'invalid'
end
status 200
response
end
end
end