Closed tompipe closed 1 year ago
Amending the doctype structure so doctype2 is composed of doctype1 the property is correctly returning the IDoctype1 interface. So it only seems to be an issue with doctype inheritance
Thanks to @ja0b, a fix for this has been released in v2.2.1 (for Umbraco 8) and v4.0.1 (for Umbraco 9+)
On an MNTP picker, with two allowed doctypes, max one item.
Both doctypes are not element types, the 2nd doctype is created as a child of the 1st doctype, inheriting it's properties etc.
When generating models, the model containing the MNTP picker property is incorrectly generating the return value of the property to be IPublishedElement, when I would expect it to be IPublishedContent, or even the most specific common base model, i.e DocType1.
Looking into the source, the issue arises within
https://github.com/callumbwhyte/super-value-converters/blob/e1689b7e50d207d1b332a6640ab5ebeb3635b01f/src/Our.Umbraco.SuperValueConverters/ValueConverters/SuperValueConverterBase.cs#L49-L70
The method is returning the lowest common denominator interface, As an IPublishedContent implements IPublishedElement, it's returning IPublishedElement rather than IPublishedContent for models implementing both interfaces.