YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

TypeConverters should be able to deserialize complex types

Open ramon-garcia opened this issue 5 years ago • 2 comments

The current interface of IYamlTypeConverter one cannot deserialize a type that contains other types. Unlike that interface INodeDeserializer, the interface does not receive a nested object deserializer (Func<IParser, Type, object?> nestedObjectDeserializer).

This makes it difficult to customize deserialization of custom types. Implementing IYamlConvertible is another option, but forces one to mix class code with yaml deserialization code, and is not possible for types from third party libraries.

ramon-garcia avatar Dec 09 '19 15:12 ramon-garcia

The general problem with these libraries is the impedance between the object model and the Yaml model. Every step to make them closer will make the library much more useful.

ramon-garcia avatar Dec 09 '19 15:12 ramon-garcia

I agree that the IYamlTypeConverter interface needs to be reworked. It is annoying that doing so would introduce a breaking change, but it would probably not be too disturbing.

aaubry avatar Mar 13 '20 16:03 aaubry