smithy-lang / smithy-python

Smithy code generators and core modules for Python (in development)
Apache License 2.0
47 stars 10 forks source link

Throws error when deserialising float array which contains only integers #256

Open svectordb opened 3 months ago

svectordb commented 3 months ago

I have a simple model containing a type similar to:

list Vector { member: Float }

When my service returns an array of numbers which by chance are exactly integers (e.g. [1,2,3,4] instead of [1,2,3,4.1]) Python deserialises these as integers instead of floats and this line throws an error https://github.com/smithy-lang/smithy-python/blob/f6df9f8b10ef2171e91aad21bbc66b60aae333d3/python-packages/smithy-core/smithy_core/utils.py#L51

I feel to fix this limited_parse_float should automatically cast any ints to floats before enforcing type checking