diff options
| author | Alexandru Croitor <acroitor@gitlab.com> | 2019-05-17 12:46:33 +0300 |
|---|---|---|
| committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-05-17 13:56:25 +0300 |
| commit | 9ff6edf690423a284f4d0ad924ff2a9a4285eb50 (patch) | |
| tree | 9b770e812bd923a664a0c2166935794dcd3dffb3 /lib/api/validations | |
| parent | f117c032ac6c414e6c1dfeab98184363c1f61608 (diff) | |
| download | gitlab-ce-9ff6edf690423a284f4d0ad924ff2a9a4285eb50.tar.gz | |
Review updates and cleanupce-57402-add-issues-statistics-api-endpoints
* Cleaned issues and issues_statistics docs
* Renamed param with_labels_data to with_labels_details
* Added spec for N+1 check when retrieving labels from issue
* Refactoed CheckAssigneesCount validation class
Diffstat (limited to 'lib/api/validations')
| -rw-r--r-- | lib/api/validations/check_assignees_count.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/api/validations/check_assignees_count.rb b/lib/api/validations/check_assignees_count.rb index e19c88e97b1..836ec936b31 100644 --- a/lib/api/validations/check_assignees_count.rb +++ b/lib/api/validations/check_assignees_count.rb @@ -6,12 +6,8 @@ module API def self.coerce lambda do |value| case value - when String - [value] - when Array - value - when CheckAssigneesCount - value + when String, Array + Array.wrap(value) else [] end @@ -19,11 +15,11 @@ module API end def validate_param!(attr_name, params) - unless param_allowed?(attr_name, params) - raise Grape::Exceptions::Validation, - params: [@scope.full_name(attr_name)], - message: "allows one value, but found #{params[attr_name].size}: #{params[attr_name].join(", ")}" - end + return if param_allowed?(attr_name, params) + + raise Grape::Exceptions::Validation, + params: [@scope.full_name(attr_name)], + message: "allows one value, but found #{params[attr_name].size}: #{params[attr_name].join(", ")}" end private |
