Consider this simple program:
using System;
using YamlDotNet.RepresentationModel;
namespace TestYamlNode
{
class Program
{
static void Main(string[] args)
{
var scalarNode = new YamlScalarNode("!yada");
scalarNode.Style = YamlDotNet.Core.ScalarStyle.Plain;
var serializer = new YamlDotNet.Serialization.Serializer();
serializer.Serialize(Console.Out, scalarNode);
scalarNode = new YamlScalarNode("yada");
scalarNode.Style = YamlDotNet.Core.ScalarStyle.Plain;
serializer.Serialize(Console.Out, scalarNode);
}
}
}
The oputput of the program is:
'!yada'
yada
Is there a way to tell YamlDotNet to not include single quotes in the output when it has characters like !, { etc. included in it? For some context, I'm processing a AWS SAM template that has a property that looks like this:
uri: !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PetStorePetFunc.Arn}/invocations