Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency while treating fields as numbers or strings when reading or writing them #197

Open
lgyurci opened this issue Jan 13, 2025 · 0 comments

Comments

@lgyurci
Copy link

lgyurci commented Jan 13, 2025

Reproduction:

  1. Create a test file (test.yaml) with the following content:
a: abc
b: cba
  1. Change the value of "a" to the string "23695230e640":
yq -i -y '.a="23695230e640"' test.yaml
  1. Observe that the value is correctly changed in the file:
» cat test.yaml
a: 23695230e640
b: cba
  1. Make another change to a field other than "a":
yq -i -y '.b="abc"' test.yaml
  1. Observe the file again, and notice how the field "a" got treated as a number in this case:
» cat test.yaml
a: 1.7976931348623157e+308
b: abc

This breaks some processes. The value of "a" should not change if only the value of "b" is changed, and "a" should be consistently treated either as a number, or as a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant