kaml icon indicating copy to clipboard operation
kaml copied to clipboard

Print YamlNodes

Open F0Xde opened this issue 3 years ago • 3 comments

Sorry if this is an unnecessary question, but due to the lack of documentation I am unsure how I would go about constructing a YAML document manually from the different YamlNode types and then "serialize" it later (like one could do with the typical JsonElements). The only thing I could find was the contentToString() function, but while this may be fine it does not provide a way to format the resulting output in a pretty manner and customize this behaviour using a YamlConfiguration. Again, very sorry if I am just missing this, but I could not find anything like json's JsonElementSerializer (which is also automatically used by the extension methods with reified type parameters, something that seems missing here too).

F0Xde avatar Feb 01 '21 21:02 F0Xde

Hi @F0Xde, this isn't something that is currently supported. Writing a YamlElementSerializer similar to the built-in JsonElementSerializer wouldn't be too difficult - if you're interested in doing this, I'd gladly accept a PR, but I don't have time to add this at the moment.

charleskorn avatar Feb 03 '21 05:02 charleskorn

I just started implemting such a serializer

pschichtel avatar Jul 03 '22 16:07 pschichtel

I created #302, but I'm personally not happy with the implementation and I'll be switching to a different approach anyway, but maybe someone else can pick this up.

pschichtel avatar Jul 03 '22 19:07 pschichtel

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues. If this issue is still affecting you, please comment below within the next seven days. Thank you for your contributions.

stale[bot] avatar Sep 01 '22 19:09 stale[bot]

This issue has been automatically closed because it has not had any recent activity.

stale[bot] avatar Sep 09 '22 03:09 stale[bot]