FSharp.Data
FSharp.Data copied to clipboard
Numeric inference in 3.0.0 appears broken
In FSharp.Data 3.0.0-beta4, inference for a JSON with a numeric array field worked properly. When attempting to upgrade to 3.0.0, however, the inference breaks, and the inferred type is int []. I'm currently working on a repro test case. This is preventing our ability to update to the 3.0.0 release version.
I suspect this commit may be the culprit, but I'm still looking: https://github.com/fsharp/FSharp.Data/commit/8d05e4bf32fe750cb0f1bad977cbd5b97b39ab17
What does your numeric array field look like? After bumping to v3.0, 0.1e1 is inferred as int. To fix it I had to change to 0.1e0 or 0.11e1.
For arrays, make sure all the entries are in exponential format. Maybe that helps.
I'm figuring out ways to work around this, but I think the general inference should be that, if there's an e or E in the string representation, it should be a float.
I think we could solve this with some additional information attached to the JsonValue.Float case that let us know if the float value was exponential or not. Then we could use that flag to disallow inferring the sample value as an integer at all.