Skip to content

Commit

Permalink
Merge pull request #108 from neuroglia-io/fix-yaml-serialization
Browse files Browse the repository at this point in the history
Fixes the UriTypeSerializer to properly serialize URI instances (original string vs to string)
  • Loading branch information
cdavernas authored Aug 21, 2024
2 parents 9763af0 + f566d1e commit 6ecf1aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public virtual object ReadYaml(IParser parser, Type type)
public virtual void WriteYaml(IEmitter emitter, object? value, Type type)
{
if (value == null) return;
emitter.Emit(new Scalar(((Uri)value).ToString()));
emitter.Emit(new Scalar(((Uri)value).OriginalString));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class YamlSerializer(YamlDotNet.Serialization.ISerializer serializer, IDe
deserializer
.IgnoreUnmatchedProperties()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.WithNodeTypeResolver(new InferTypeResolver())
.WithNodeDeserializer(
inner => new StringEnumDeserializer(inner),
syntax => syntax.InsteadOf<ScalarNodeDeserializer>())
.WithNodeTypeResolver(new InferTypeResolver())
.WithNodeDeserializer(
inner => new JsonObjectDeserializer(inner),
syntax => syntax.InsteadOf<DictionaryNodeDeserializer>())
Expand Down

0 comments on commit 6ecf1aa

Please sign in to comment.