Need a way to discover anchored nodes in parsed Yaml

Issue #441 resolved
Kris De Volder created an issue

In SnakeYaml version 1.19 we could use method Node.getAnchor(). But it seems this method has been removed (I think since 1.20).

Unless I am missing something this means its now completely impossible to recognize whether a given 'Node' in the parsed yaml was anchored. If I am wrong, a pointer to how this can be done in current version 1.24 would be appreciated. If I am right, please consider re-instating the Node.getAnchor() method, or provide another means to recognize anchor nodes (and discover the name of its corresponding anchor).

If you are curious why I need this... It is because I am using snakeyaml as part of tool that validates yaml structure. Users of this tool have indicated they expect acnhored nodes to be treated specially because... they are often used (or abused?) to setup a 'template node' to be inserted in other places of their document. See: https://github.com/spring-projects/sts4/issues/58#issuecomment-395620770

Comments (8)

  1. Kris De Volder reporter

    Sorry haven't responded sooner. I will try to test the snapshot soon as I would like to adopt the fix. Testing SnakeYAML engine may be a bit tricky however, since our code doesn't use it (but perhaps it should... so I will have a look at it too... can't make hard promises though).

  2. Log in to comment