summaryrefslogtreecommitdiff
path: root/lib/api/features.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/features.rb')
-rw-r--r--lib/api/features.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/api/features.rb b/lib/api/features.rb
index 2ce2f7c518f..398e57794c8 100644
--- a/lib/api/features.rb
+++ b/lib/api/features.rb
@@ -14,7 +14,12 @@ module API
when '0', 'false'
false
else
- params[:value].to_i
+ # https://github.com/jnunemaker/flipper/blob/master/lib/flipper/typecast.rb#L47
+ if params[:value].to_s.include?('.')
+ params[:value].to_f
+ else
+ params[:value].to_i
+ end
end
end
@@ -59,7 +64,7 @@ module API
success Entities::Feature
end
params do
- requires :value, type: String, desc: '`true` or `false` to enable/disable, an integer for percentage of time'
+ requires :value, type: String, desc: '`true` or `false` to enable/disable, a float for percentage of time'
optional :key, type: String, desc: '`percentage_of_actors` or the default `percentage_of_time`'
optional :feature_group, type: String, desc: 'A Feature group name'
optional :user, type: String, desc: 'A GitLab username'