WritablePropertiesTypeInspector does not respect the `Alias` from `YamlConverterAttribute`
Describe the bug
The WritablePropertiesTypeInspector does not take into account the Alias property of the YamlConverterAttribute.
It is missing in the constructor of the ReflectionPropertyDescriptor.
If I create a PR for this, would it be accepted and merged soon?
Ahh, now I see it.
I have to chain the TypeInspectors.
public static DeserializerBuilder CreateDeserializerBuilder()
{
WritablePropertiesTypeInspector writablePropertiesInspector = new WritablePropertiesTypeInspector(new DynamicTypeResolver());
YamlAttributesTypeInspector writablePropertiesInspectorWithYamlAttribute = new YamlAttributesTypeInspector(writablePropertiesInspector);
DeserializerBuilder deserializerBuilder = new DeserializerBuilder();
deserializerBuilder.WithoutTypeInspector<YamlAttributesTypeInspector>();
deserializerBuilder.WithTypeInspector(_ => writablePropertiesInspectorWithYamlAttribute);
return deserializerBuilder;
}
Is that correct, or am I making a mistake here?
You dont chain the type inspector. It takes in a type resolver. And if I remember right, the alias is taken into account higher up in the call stack.
Ok, I take that back. You do bring in the other type inspectors. Though I think that is done with the WithTypeInspector. And you don't want to remove the YamlAttributesTypeInspector, that's where it determines the alias of the property/field. Should be higher up in the call chain than the WritablePropertiesInspector.
If i don't remove it, I will get an Exception that it is already registered.