vals icon indicating copy to clipboard operation
vals copied to clipboard

#190-FetchInteger: Fix

Open artiodev opened this issue 1 year ago • 9 comments

https://github.com/helmfile/vals/issues/190 Handles int and bool types when returned as string map value.

artiodev avatar Aug 08 '24 15:08 artiodev

@artiodev thanks so much. could you add some tests?

yxxhero avatar Aug 08 '24 23:08 yxxhero

@yxxhero Done

artiodev avatar Aug 12 '24 22:08 artiodev

@mumoshu WDYT?

yxxhero avatar Aug 12 '24 23:08 yxxhero

Hello @mumoshu, You're right! This is the result I want, but I think is quite difficult to have. ResultBool: "true" ResultInteger: "1" ResultBool: true ResultInteger: 1 Maybe it could be change the Lookup function using Generics type?

However at the moment this solution could be enough for me.

Thanks!

artiodev avatar Aug 13 '24 08:08 artiodev

Hey @artiodev! Thanks for confirming!

From vals' design perspective, I believe that both work if each is enabled only in an opt-in manner.

Would you like it, if it looked like this:

fetched value ref URL param result
1 error (because vals expects string by default)
1 as=int 1
1 as=string "1"
true error (because vals expects string by default)
true as=int error (because we won't define true->int conversion or vice versa)
true as=bool true
true as=string "true"

We initially implement as=int and as=bool only because I suppose, in many cases, you don't need to turn anything into strings with vals. Put another way, we won't have as=string until it's absolutely necessary.

Does that make sense to you?

cc/ @yxxhero

mumoshu avatar Aug 16 '24 02:08 mumoshu

Hey @artiodev! Thanks for confirming!

From vals' design perspective, I believe that both work if each is enabled only in an opt-in manner.

Would you like it, if it looked like this:

fetched value ref URL param result 1 error (because vals expects string by default) 1 as=int 1 1 as=string "1" true error (because vals expects string by default) true as=int error (because we won't define true->int conversion or vice versa) true as=bool true true as=string "true" We initially implement as=int and as=bool only because I suppose, in many cases, you don't need to turn anything into strings with vals. Put another way, we won't have as=string until it's absolutely necessary.

Does that make sense to you?

cc/ @yxxhero

yeah. it's better.

yxxhero avatar Aug 20 '24 05:08 yxxhero

yeah, This solution is even better

artiodev avatar Aug 20 '24 09:08 artiodev

hi any chance to get this marge ?

elkh510 avatar Sep 30 '25 15:09 elkh510

@elkh510 This is WIP, it currently has a breaking change behavior that needs to be moved as a opt-in behavior.

aslafy-z avatar Sep 30 '25 16:09 aslafy-z