Skip to content

Commit

Permalink
chore: Adjust serializer and deserializer for yaml v16
Browse files Browse the repository at this point in the history
  • Loading branch information
timo-reymann committed Nov 23, 2024
1 parent 6dce9c5 commit a687a08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions UniLaunch.Core/Storage/YAML/TimeOnlyConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public bool Accepts(Type type)
{
return type == typeof(TimeOnly);
}

public object ReadYaml(IParser parser, Type type)
public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
{
var scalar = parser.Consume<Scalar>();
if (TimeOnly.TryParseExact(scalar.Value, Format, out var time))
Expand All @@ -27,8 +27,8 @@ public object ReadYaml(IParser parser, Type type)

throw new YamlException($"Invalid TimeOnly format: {scalar.Value}. Expected format: {Format}");
}

public void WriteYaml(IEmitter emitter, object? value, Type type)
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer)
{
if (value is TimeOnly time)
{
Expand Down
6 changes: 3 additions & 3 deletions UniLaunch.Core/Storage/YAML/UriConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ public bool Accepts(Type type)
return type == typeof(Uri);
}

public object? ReadYaml(IParser parser, Type type)
public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
{
var scalar = parser.Consume<Scalar>();

if (Uri.TryCreate(scalar.Value, new UriCreationOptions() { }, out var uri))
if (Uri.TryCreate(scalar.Value, new UriCreationOptions(), out var uri))
{
return uri;
}

throw new YamlException($"Invalid URI: {scalar.Value}");
}

public void WriteYaml(IEmitter emitter, object? value, Type type)
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer)
{
if (value is Uri uri)
{
Expand Down

0 comments on commit a687a08

Please sign in to comment.