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

Failed to parse unquoted string in mapping value containing ? #2294

Open
fa93hws opened this issue Feb 19, 2025 · 0 comments
Open

Failed to parse unquoted string in mapping value containing ? #2294

fa93hws opened this issue Feb 19, 2025 · 0 comments
Labels

Comments

@fa93hws
Copy link

fa93hws commented Feb 19, 2025

Describe the bug
A clear and concise description of what the bug is.

Note that any how to questions should be posted in the discussion board and not raised as an issue.

Version of yq: 4.45.1
Operating system: mac
Installed via: docker/binary release/homebrew/snap/...

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

# this works
foo: {bar: "a?bc"}

data2.yml:

# failed to parse 
foo: {bar: a?bc}

Command
The command you ran:

yq data2.yml

Actual behavior

Error: bad file 'pnpm-lock.yaml': yaml: did not find expected ',' or '}'

Expected behavior
No error

Additional context
Yaml spec didn't mentioned anything about ? being special so it should be fine to be unquoted. https://yaml.org/spec/1.2.2/#822-block-mappings
I've tried a bunch of online yaml parser (like https://onlineyamltools.com/validate-yaml, https://jsonformatter.org/yaml-validator, https://yamlchecker.com/ and https://www.yamllint.com/) and they are fine with it.
Libraries like js-yaml (npm) and serde_yaml (rust) has no problem to parse this as well

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