Skip to content

cake-contrib/Cake.Yaml

Repository files navigation

Cake.Yaml

A set of aliases for cakebuild.net to help with YAML Serialization.

License

You can easily reference Cake.Yaml directly in your build script via a Cake addin:

#addin nuget:?package=Cake.Yaml&version=6.0.0
#addin nuget:?package=YamlDotNet&version=12.3.1

NOTE: It's very important at this point in time to specify the YamlDotNet package and the version 12.3.1 for it.

Aliases

Please visit the Cake Documentation for a list of available aliases:

https://cakebuild.net/dsl/yaml

Naming conventions

Since version 5.0.0, Cake.Yaml supports naming conventions implemented in YamlDotNet. E.g.:

var settings = new SerializeYamlSettings
{
    NamingConvention = CamelCaseNamingConvention.Instance,
};

var serialized = SerializeYaml(someObject, settings);

YamlDotNet includes a number of naming conventions out of the box:

Naming convention class Description
CamelCaseNamingConvention Convert the string with underscores (this_is_a_test) or hyphens (this-is-a-test) to camel case (thisIsATest)
HyphenatedNamingConvention Convert the string from camelcase (thisIsATest) to a hyphenated (this-is-a-test) string
LowerCaseNamingConvention Convert the string with underscores (this_is_a_test) or hyphens (this-is-a-test) to lower case (thisisatest)
NullNamingConvention Performs no naming conversion
PascalCaseNamingConvention Convert the string with underscores (this_is_a_test) or hyphens (this-is-a-test) to pascal case (ThisIsATest)
UnderscoredNamingConvention Convert the string from camelcase (thisIsATest) to a underscored (this_is_a_test) string

You can implement your own naming convention by creating a class that implements the INamingConvention interface.

Discussion

For questions and to discuss ideas & feature requests, use the GitHub discussions on the Cake GitHub repository, under the Extension Q&A category.

Join in the discussion on the Cake repository