You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Yamale with default options produces the following error:
yaml.composer.ComposerError: found duplicate anchor; first occurrence
in "test.yaml", line 3, column 11
second occurrence
in "test.yaml", line 7, column 11
Same behavior with --parser ruamel but the exception is ruamel.yaml.composer.ComposerError.
As described here, ruamel.yaml can parse this correctly, but pure=True must be specified when initializing it:
defparse_yaml(path=None, parser='pyyaml', content=None):
try:
parse=_parsers[parser.lower()]
exceptKeyError:
raiseNameError('Parser "'+parser+'" is not supported\nAvailable parsers are listed below:\nPyYAML\nruamel')
Before raising the NameError, we can try to load the module/function that is passed into the parser argument by the -p option. If it exists, then use that as the parser.
I'm happy to review any pull request that will implement what I've mentioned above. Let me know if you have any questions.
Hello and thank you for this tool.
Consider the following sample YAML file:
Note the two anchors with the same name, which is fine according to the YAML specification. Here is a schema to validate this file:
Running Yamale with default options produces the following error:
Same behavior with
--parser ruamel
but the exception isruamel.yaml.composer.ComposerError
.As described here, ruamel.yaml can parse this correctly, but
pure=True
must be specified when initializing it:Can you please consider adding a flag to toggle the
pure
option in ruamel so Yamale doesn't error out in this scenario?The text was updated successfully, but these errors were encountered: