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

Inline map missing values are strings instead of null #2288

Open
thatch opened this issue Feb 13, 2025 · 0 comments
Open

Inline map missing values are strings instead of null #2288

thatch opened this issue Feb 13, 2025 · 0 comments
Labels

Comments

@thatch
Copy link

thatch commented Feb 13, 2025

Describe the bug

My read of the yaml spec is that when only a key is present in a mapping, the value should be interpreted as null. While yq does this for block mappings, it assumes empty-string for inline mappings.

Version of yq: v4.45.1
Operating system: mac
Installed via: homebrew

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:

{x}

Command
The command you ran:

echo '{x}' | yq .

Actual behavior

{x: ''}

Expected behavior

{x: null}

Additional context
The expected behavior is also produced by pyyaml.

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

No branches or pull requests

1 participant