YamlDotNet
YamlDotNet copied to clipboard
TypeConverters should be able to deserialize complex types
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.
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.
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.