diff options
Diffstat (limited to 'lib/api/lint.rb')
-rw-r--r-- | lib/api/lint.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/api/lint.rb b/lib/api/lint.rb index b1c6f52bccb..98010cf3b68 100644 --- a/lib/api/lint.rb +++ b/lib/api/lint.rb @@ -5,22 +5,18 @@ module API 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: '' - } + namespace 'ci' do + post '/lint' do + errors = Ci::GitlabCiYamlProcessor.validation_message(params[:content]) - if error.blank? - response[:status] = 'valid' - else - response[:error] = error - response[:status] = 'invalid' - end + status 200 - status 200 - response + if errors.blank? + { status: 'valid', errors: [] } + else + { status: 'invalid', errors: [errors] } + end + end end end end |