As discussed with @ingydotnet; opening here after discussion on mikefarah/yq#2406 as yq depends on this library and the bug has been confirmed to be related to this library.
Describe the bug
In the yq application, it is possible render/resolve anchors/aliases through the explode operator.
Unmarshalling fails due to parsing errors in this library.
Other used library has been confirmed not being the cause.
Reproduction
Reproduced in https://github.com/TyIsI/fafo-go-yaml/blob/main/yaml-go-yaml/main.go
More info from original issue
Input Yaml
Message.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
yq -P eval-all "explode(.) | select(document_index == 1)" Message.yml
Actual behavior
Error: bad file '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
As discussed with @ingydotnet; opening here after discussion on mikefarah/yq#2406 as yq depends on this library and the bug has been confirmed to be related to this library.
Describe the bug
In the yq application, it is possible render/resolve anchors/aliases through the
explodeoperator.Unmarshalling fails due to parsing errors in this library.
Other used library has been confirmed not being the cause.
Reproduction
Reproduced in https://github.com/TyIsI/fafo-go-yaml/blob/main/yaml-go-yaml/main.go
More info from original issue
Input Yaml
Message.yml:
Command
yq -P eval-all "explode(.) | select(document_index == 1)" Message.ymlActual behavior
Expected behavior
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