From ba7452efcda25ffa09b69f29cfe7d449df1db703 Mon Sep 17 00:00:00 2001 From: ewezy Date: Tue, 16 Jul 2024 13:40:42 +0800 Subject: [PATCH] Update autoscaling policy target validation tag --- api/turing/models/autoscaling_policy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/turing/models/autoscaling_policy.go b/api/turing/models/autoscaling_policy.go index 32fed13ed..545212942 100644 --- a/api/turing/models/autoscaling_policy.go +++ b/api/turing/models/autoscaling_policy.go @@ -25,7 +25,9 @@ type AutoscalingPolicy struct { // Target is the target value of the metric that should be reached to add a new replica. // It is expected that the autoscaling target is an absolute value for concurrency / rps // while it is a % value (of the requested value) for cpu / memory. - Target string `json:"target" validate:"required,number"` + // The 'numeric' type is used to allow decimals in strings to be set as the target value, + // e.g. "8.88". See https://github.com/go-playground/validator/issues/940 for more details. + Target string `json:"target" validate:"required,numeric"` } func (a AutoscalingPolicy) Value() (driver.Value, error) {