Skip to content

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

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

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

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

fa93hws opened this issue Feb 19, 2025 · 3 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

@yesudeep
Copy link

yesudeep commented Mar 6, 2025

+1 Would appreciate if this could be addressed. Some of our pnpm based projects would be unblocked if this were addressed.

@jbedard
Copy link

jbedard commented Mar 6, 2025

@mikefarah have you had a chance to look at this one? yq fails to parse some pnpm yaml files with the latest pnpm v10

@Mivr
Copy link

Mivr commented Mar 11, 2025

Analyzed the issue in yq and the root of the issue is actually the yaml parsing library: https://github.com/go-yaml/yaml
Opened an issue there: go-yaml/yaml#1070

However go-yaml is not maintained from 3 years, so chances of a fix there are low.

yq has a ticket to migrate to https://github.com/goccy/go-yaml here: #2298
I tested go-yaml locally and it parses "foo: {bar: a?bc}" properly.

Thus this issue seems to be blocked by: #2298

Is anyone working on #2298?

This issue is also blocking: aspect-build/rules_js#2100

yesudeep added a commit to google/dotprompt that referenced this issue Mar 24, 2025
…goccy/go-yaml

https://github.com/go-yaml/yaml has several issues pending and it appers
that it is no longer maintained.

e.g.: mikefarah/yq#2294

The general recommendation is to switch to a more maintained YAML parser
implementation.

CHANGELOG:
- [ ] Switch to https://github.com/goccy/go-yaml since it is maintained
yesudeep added a commit to google/dotprompt that referenced this issue Mar 24, 2025
…goccy/go-yaml

https://github.com/go-yaml/yaml has several issues pending and it appers
that it is no longer maintained.

e.g.: mikefarah/yq#2294

The general recommendation is to switch to a more maintained YAML parser
implementation.

CHANGELOG:
- [ ] Switch to https://github.com/goccy/go-yaml since it is maintained
yesudeep added a commit to google/dotprompt that referenced this issue Mar 24, 2025
…goccy/go-yaml

https://github.com/go-yaml/yaml has several issues pending and it appers
that it is no longer maintained.

e.g.: mikefarah/yq#2294

The general recommendation is to switch to a more maintained YAML parser
implementation.

CHANGELOG:
- [ ] Switch to https://github.com/goccy/go-yaml since it is maintained
yesudeep added a commit to google/dotprompt that referenced this issue Mar 24, 2025
…goccy/go-yaml

https://github.com/go-yaml/yaml has several issues pending and it appers
that it is no longer maintained.

e.g.: mikefarah/yq#2294

The general recommendation is to switch to a more maintained YAML parser
implementation.

CHANGELOG:
- [ ] Switch to https://github.com/goccy/go-yaml since it is maintained
yesudeep added a commit to google/dotprompt that referenced this issue Mar 24, 2025
…goccy/go-yaml (#151)

https://github.com/go-yaml/yaml has several issues pending and it appers
that it is no longer maintained.

e.g.: mikefarah/yq#2294

The general recommendation is to switch to a more maintained YAML parser
implementation.

CHANGELOG:
- [ ] Switch to https://github.com/goccy/go-yaml since it is maintained
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

4 participants