summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/lint.rb23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/api/lint.rb b/lib/api/lint.rb
index 2757b800af0..ff35e948e0c 100644
--- a/lib/api/lint.rb
+++ b/lib/api/lint.rb
@@ -9,23 +9,20 @@ module API
post do
response = {
status: '',
- errors: [],
+ error: [],
jobs: []
}
- if !Ci::GitlabCiYamlProcessor.errors(@content).nil?
- status 200
- response[:errors].push(Ci::GitlabCiYamlProcessor.errors(@content))
- response[:status] = 'invalid'
-
- response
- end
+ if Ci::GitlabCiYamlProcessor.errors(params[:content]).nil?
+ config_processor = Ci::GitlabCiYamlProcessor.new(params[:content])
- config_processor = Ci::GitlabCiYamlProcessor.new(params[:content])
-
- config_processor.builds.each do |build|
- response[:jobs].push("#{build[:name]}")
- response[:status] = 'valid'
+ config_processor.builds.each do |build|
+ response[:jobs].push("#{build[:name]}")
+ response[:status] = 'valid'
+ end
+ else
+ response[:error].push(Ci::GitlabCiYamlProcessor.errors(params[:content]))
+ response[:status] = 'invalid'
end
status 200