jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

std.parseYaml() fails to parse 3 digits versions

Open ericcitaire opened this issue 2 years ago • 4 comments

Simplest way to reproduce :

$ jsonnet -e "std.parseYaml('version: 1.2.3')"
Something went wrong during jsonnet_evaluate_snippet, please report this: [json.exception.parse_error.101] parse error at line 1, column 16: syntax error while parsing object - invalid literal; last read: '1.2.'; expected '}'
[1]    443873 IOT instruction (core dumped)  jsonnet -e "std.parseYaml('version: 1.2.3')"

It seems to be parsing a float instead of a string.

ericcitaire avatar Sep 06 '22 14:09 ericcitaire

This was fixed in rapidyaml a few days ago : https://github.com/biojppm/rapidyaml/pull/299

ericcitaire avatar Sep 08 '22 08:09 ericcitaire

I guess go-jsonnet would work fine, as it uses a different YAML parser.

We should bump the rapidyaml version here.

sbarzowski avatar Sep 11 '22 15:09 sbarzowski

Hi, is there any plan to update rapidyaml version in jsonnet to address the issue? Not sure why this issue wasn't fixed in the v0.20.0 cycle.

jzhn avatar Jun 09 '23 22:06 jzhn

I'm upgrading Rapid YAML in #1134 - I'll confirm this works then.

johnbartholomew avatar Feb 09 '24 18:02 johnbartholomew

Should work on master now. I have added a test case for it (https://github.com/google/jsonnet/pull/1135). Thanks for the bug report!

johnbartholomew avatar Feb 27 '24 13:02 johnbartholomew