-
Notifications
You must be signed in to change notification settings - Fork 2
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
YAML serialization can use new OmitDefaultsOrEmpty
#40
Comments
Do you have an example? Wouldn't this just skip steps from the output? |
Yes, it would. But at least in Azure Pipelines YAML you don't want to show some of these when empty. I don't know how you deal with collections but in Sharpliner, I pre-initialize Say you have this: class SomeClass
{
List<string> SomeProperty { get; set; } = new();
} then you can do this: var x = new SomeClass
{
SomeProperty = {
"foo",
"bar",
}
} However, this implicit Now, let's say you have pipeline triggers and want to use this - this means your triggers: [] You only want triggers to be serialized when it's not empty. Now, I don't know GH Actions much so I don't know if you have problems like this. Or you might just have |
Btw I reached out to you in a more reasonable manner on Teams but I guess you're off already (I didn't mean to ambush you here like this) |
I'm pretty sure that |
GitHubActionsDotNet/src/GitHubActionsDotNet/Serialization/YamlSerialization.cs
Line 20 in aa0f0a1
I was also serializing pipeline YAML and often had the resulting YAML full of empty arrays, things like:
This is just an FYI that I added functionality there that also omits empty collections. Not sure if you are hitting this but might be of use to you too.
https://github.com/aaubry/YamlDotNet/releases/tag/v11.2.0
aaubry/YamlDotNet#608
The text was updated successfully, but these errors were encountered: