-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Allow to Serialize with line breaks between sections #804
Conversation
@EdwardCooke, would it be possible to get someone to review this? |
Maybe also related to #523? I will have a look |
Actually this is more related to serialization, will update the title and description |
I’ll try and take a look this weekend. |
Sorry for the long delay, was on vacation :) Anyways, what I would prefer is a way of adding any arbitrary content before it, that way it can be whatever is desired by the developer, if we did this as a string, then people could put in whatever the feel like, including something like something:
# i like
# new lines!
like: that
or: just a new line Also, you'll need to do this on a branch in your fork named something other than |
No worries, I have mixed feelings about that, I mean it would be more flexible for sure, but at the same time it would allow you to serialize an invalid yaml, while this way it would be more restricted. |
I’ve been thinking about this more. I really think having the ability to put whatever a person wants in there is a good thing due to flexibility. One idea I have is maybe a check in the attribute setter that makes sure every line is either empty or starts with spaces and/or pound sign. That would guarantee a valid yaml structure at compile time, in theory. I’d like that tested to make sure. But at least it would be validated at runtime at the very least. |
Another issue here is that your branch shouldn't be on master, please create your own, otherwise the build will fail. |
Are you going to create your own, non-master, branch? Or can I close this? |
I am closing this PR as the approach that you want to follow is a more flexible one and I am not actually sure that those changes are as simple to implement, in the way that I am afraid of users breaking the seriaization/deserialization due to such flexibility. |
This is related to the issue that I described here #803.
For my usage it's important to be able to serialize a Yaml with line breaks.
Due to yaml's nature, which is declarative and human readable I think it makes sense to support it. We often see files like docker-compose separating sections by break line.
With this PR, that would be possible, either by using YamlMemberAttribute, or by emiting the event manually.
Please let me know if there's an existing and more straightforward way of doing this, then I will abort my PR.
Thanks.