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

duplicate anchors throw ComposerError #100

Open
NikkyAI opened this issue Nov 25, 2017 · 4 comments
Open

duplicate anchors throw ComposerError #100

NikkyAI opened this issue Nov 25, 2017 · 4 comments
Labels

Comments

@NikkyAI
Copy link

NikkyAI commented Nov 25, 2017

import yaml

foo = """
foo: &foo "foo"
bar:
    x: *foo
    y: &foo "bar"
    z: *foo
"""

bar = yaml.load(foo)
print(bar)

according to the yaml specification here http://yaml.org/spec/1.2/spec.html#anchor//

When composing a representation graph from serialized events, an alias node refers to the most recent node in the serialization having the specified anchor. Therefore, anchors need not be unique within a serialization. In addition, an anchor need not have an alias node referring to it. It is therefore possible to provide an anchor for all nodes in serialization.

this was fixed in older version of ruaml.yaml apparently as well before reintroducing the bug

@NikkyAI NikkyAI closed this as completed Aug 31, 2018
@perlpunk
Copy link
Member

not sure why this was closed, as it is indeed a bug

@lousyd
Copy link

lousyd commented Aug 29, 2019

I too have encountered this problem while processing some gitlab ci yaml files. The files have duplicate anchors but are perfectly valid. When I modified a temporary local copy of the yaml files to remove the duplicates issue, the files processed fine.

@neronmoon
Copy link

Hmm, is there any workarounds?

@perlpunk
Copy link
Member

Hmm, is there any workarounds?

Not that I know of, but there is a pending PR: #394

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