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

Fix "null" string encoded as nil #474

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Fix "null" string encoded as nil #474

merged 1 commit into from
Oct 28, 2024

Conversation

denieryd
Copy link
Contributor

@denieryd denieryd commented Sep 27, 2024

This PR fixing this open issue: #413

Solution: incorporate each keyword from reservedNullKeywords into reservedEncKeywordMap to indicate that null keywords should be enclosed in quotes. This ensures that only Golang's nil is represented as YAML null.

Currently, any string from reservedNullKeywords is being encoded as YAML null, which is not the intended behavior and may cause confusion. Because users use Golang's nil if they want YAML null and for some reason "null" string if they want string in yaml document

This fix reverts the some behavior that was erroneously changed in this this commit. Prior to this commit, only Golang's nil was represented as YAML null.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.79%. Comparing base (3a90d71) to head (fa39d09).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #474      +/-   ##
==========================================
+ Coverage   78.78%   78.79%   +0.01%     
==========================================
  Files          13       13              
  Lines        4007     4009       +2     
==========================================
+ Hits         3157     3159       +2     
  Misses        591      591              
  Partials      259      259              

@Nikscorp
Copy link

Nikscorp commented Oct 1, 2024

@goccy can you review this pr please?

@goccy
Copy link
Owner

goccy commented Oct 28, 2024

Thank you for your contribution ! LGTM 👍

@goccy goccy merged commit e77cb4d into goccy:master Oct 28, 2024
17 checks passed
jandubois added a commit to jandubois/lima that referenced this pull request Nov 1, 2024
We used a custom marshaller to properly marshal "~" and "null".
This has been fixed in goccy/go-yaml#474,
which has been merged in lima-vm#2828.

Dropping the custom marshaller fixes lima-vm#2665.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
subpop pushed a commit to subpop/lima that referenced this pull request Dec 4, 2024
We used a custom marshaller to properly marshal "~" and "null".
This has been fixed in goccy/go-yaml#474,
which has been merged in lima-vm#2828.

Dropping the custom marshaller fixes lima-vm#2665.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
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

Successfully merging this pull request may close these issues.

4 participants