Compare commits

...

1 Commits

Author SHA1 Message Date
Yuan Teoh
4416b14ee6 fix: optional parameter int type conversion 2025-07-01 11:27:23 -06:00
2 changed files with 8 additions and 1 deletions

View File

@@ -319,6 +319,13 @@ func parseParamFromDelayedUnmarshaler(ctx context.Context, u *util.DelayedUnmars
if err := dec.DecodeContext(ctx, a); err != nil {
return nil, fmt.Errorf("unable to parse as %q: %w", t, err)
}
if a.Default != nil {
intD, ok := a.Default.(uint64)
if !ok {
return nil, fmt.Errorf("default value fail to assert to type int64")
}
a.Default = int(intD)
}
if a.AuthSources != nil {
logger.WarnContext(ctx, "`authSources` is deprecated, use `authServices` for parameters instead")
a.AuthServices = append(a.AuthServices, a.AuthSources...)

View File

@@ -150,7 +150,7 @@ func TestParametersMarshal(t *testing.T) {
},
},
want: tools.Parameters{
tools.NewIntParameterWithDefault("my_integer", uint64(5), "this param is an int"),
tools.NewIntParameterWithDefault("my_integer", 5, "this param is an int"),
},
},
{