Commit 604870a6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'api-no-convert' into 'master'

Don't convert data which already is the target type

With Grape's DSL we already enforce data types. We don't need to explicitly convert to string if there is already one.

See merge request !7740
parents c66502a2 9dfbfbb2
...@@ -77,7 +77,7 @@ module API ...@@ -77,7 +77,7 @@ module API
) )
begin begin
case params[:state].to_s case params[:state]
when 'pending' when 'pending'
status.enqueue! status.enqueue!
when 'running' when 'running'
......
...@@ -48,7 +48,7 @@ module API ...@@ -48,7 +48,7 @@ module API
requires :id, type: Integer, desc: 'The project ID' requires :id, type: Integer, desc: 'The project ID'
requires :branch_name, type: String, desc: 'The name of branch' requires :branch_name, type: String, desc: 'The name of branch'
requires :commit_message, type: String, desc: 'Commit message' requires :commit_message, type: String, desc: 'Commit message'
requires :actions, type: Array, desc: 'Actions to perform in commit' requires :actions, type: Array[Hash], desc: 'Actions to perform in commit'
optional :author_email, type: String, desc: 'Author email for commit' optional :author_email, type: String, desc: 'Author email for commit'
optional :author_name, type: String, desc: 'Author name for commit' optional :author_name, type: String, desc: 'Author name for commit'
end end
......
...@@ -33,7 +33,7 @@ module API ...@@ -33,7 +33,7 @@ module API
groups = groups.search(params[:search]) if params[:search].present? groups = groups.search(params[:search]) if params[:search].present?
groups = groups.where.not(id: params[:skip_groups]) if params[:skip_groups].present? groups = groups.where.not(id: params[:skip_groups]) if params[:skip_groups].present?
groups = groups.reorder(params[:order_by] => params[:sort].to_sym) groups = groups.reorder(params[:order_by] => params[:sort])
present paginate(groups), with: Entities::Group present paginate(groups), with: Entities::Group
end end
......
...@@ -30,7 +30,7 @@ module API ...@@ -30,7 +30,7 @@ module API
end end
get ':id/variables/:key' do get ':id/variables/:key' do
key = params[:key] key = params[:key]
variable = user_project.variables.find_by(key: key.to_s) variable = user_project.variables.find_by(key: key)
return not_found!('Variable') unless variable return not_found!('Variable') unless variable
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment