Add paved.GetFloat() function#778
Conversation
This adds `paved.GetFloat()` function similar to `paved.GetString()` and `paved.GetInteger()` but returning a `float64`. Signed-off-by: Rickard von Essen <rickard.von.essen@gmail.com>
|
Thanks! Can you provide some context around what you need this for? I vaguely recall that we actually used to have something like this but intentionally dropped it, because you're not supposed to use floats in Kubernetes APIs. From https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#primitive-types:
|
|
Sorry I should have provided some context. I needed this in this PR provider-upjet-gcp#623 to read the I first assumed it was a integer since inherently a port is an int and the Terraform schema mark it as |
|
@rickard-von-essen I'm pretty confident this is a bug in upjet - these fields should not be floats in the Go structs. That violates the Kubernetes API conventions I linked above. It also doesn't make sense in most of the cases - ports, replica counts, etc presumably can never actually be a floating point number. So, I suggest we fix the bug (which I assume is in upjet) rather than adding a |
|
@negz Thanks for your insight on this. I'll close this and see if I have some time to chase down the issue in upjet. |
This adds
paved.GetFloat()function similar topaved.GetString()andpaved.GetInteger()but returning afloat64.I have:
earthly +reviewableto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.