Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/ModularPipelines/Context/IYaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,42 @@

namespace ModularPipelines.Context;

/// <summary>
/// Provides YAML serialization and deserialization functionality.
/// </summary>
public interface IYaml
{
/// <summary>
/// Serializes an object to YAML string using the default camel case naming convention.
/// </summary>
/// <typeparam name="T">The type of object to serialize.</typeparam>
/// <param name="input">The object to serialize.</param>
/// <returns>The YAML string representation of the object.</returns>
string ToYaml<T>(T input) => ToYaml(input, CamelCaseNamingConvention.Instance);

/// <summary>
/// Serializes an object to YAML string using the specified naming convention.
/// </summary>
/// <typeparam name="T">The type of object to serialize.</typeparam>
/// <param name="input">The object to serialize.</param>
/// <param name="namingConvention">The naming convention to use for property names.</param>
/// <returns>The YAML string representation of the object.</returns>
string ToYaml<T>(T input, INamingConvention namingConvention);

/// <summary>
/// Deserializes a YAML string to an object using the default camel case naming convention.
/// </summary>
/// <typeparam name="T">The type to deserialize to.</typeparam>
/// <param name="input">The YAML string to deserialize.</param>
/// <returns>The deserialized object.</returns>
T FromYaml<T>(string input) => FromYaml<T>(input, CamelCaseNamingConvention.Instance);

/// <summary>
/// Deserializes a YAML string to an object using the specified naming convention.
/// </summary>
/// <typeparam name="T">The type to deserialize to.</typeparam>
/// <param name="input">The YAML string to deserialize.</param>
/// <param name="namingConvention">The naming convention to use for property names.</param>
/// <returns>The deserialized object.</returns>
T FromYaml<T>(string input, INamingConvention namingConvention);
}
}
Loading