Open
Description
Describe the bug
As title, when explode
ing, anchors and aliases do not support the full range of valid characters as specified in the spec
Note that any how to questions should be posted in the discussion board and not raised as an issue.
Versions of yq tested:
- v4.34.1
- v4.45.4
Operating system: Linux (Ubuntu 24.04.2 LTS)
Installed via: binary release
Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:
references:
- &network.core.v1.Ping ./network/core/v1/Ping.yml
- &network.core.v1.Pong ./network/core/v1/Pong.yml
- &network.enums.v1.MessageType ./network/enums/v1/MessageType.yml
---
Message:
- - type: *network.enums.v1.MessageType
payload: *network.core.v1.Ping
- type: *network.enums.v1.MessageType
payload: *network.core.v1.Pong
Command
The command you ran:
yq -P eval-all "explode(.) | select(document_index == 1)" examples/yaml/Message.yml
Actual behavior
Error: bad file 'examples/yaml/Message.yml': yaml: line 2: did not find expected alphabetic or numeric character
Expected behavior
Message:
- - type: ./network/enums/v1/MessageType.yml
payload: ./network/core/v1/Ping.yml
- type: ./network/enums/v1/MessageType.yml
payload: ./network/core/v1/Pong.yml
Additional context
If I remove the dots and use dashes (-) or slashes (/) instead, it also doesn't work. Single string works fine.
Easy link to the spec:
https://yaml.org/spec/1.2.2/#rule-ns-anchor-name
I raised the issue on the YAML Matrix and ingy
told me to mention that they'd offered to fix it.