Need a way to discover anchored nodes in parsed Yaml
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)
-
-
I will add it back at the end of April.
-
reporter That would be great! Thanks!
-
Can you please test the snapshot ?
-
May I kindly ask you to test the same change for SnakeYAML Engine ?
-
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).
-
reporter I have tried snakeyaml 1.25 snapshot and it works fine.
-
- changed status to resolved
it will be released in version 1.25
- Log in to comment
Well, I see that anchor names were introduced in 965:64178a3c85c7589a61a9e08ceace92f393433dcd, and then removed in 1112:f210685f395d941425f5fd1fa15f3e5b5901f99c.
The pull request for introduction. I do not remember the context for the removal.
I do not mind to put it back. Probably with a minor change Node.getAnchorName()