umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

V8: Modelsbuilder returning object for custom property editors not the type from the property value converter #6792

Closed mjbarlow closed 5 years ago

mjbarlow commented 5 years ago

In previous versions of 8, I know this worked in 8.0.2. when using ModelsBuilder to generate models of data that use custom property editors then the property value converter for that custom property would fire and generate the models with the custom type. (Making the property strongly typed).

Since upgrading to version 8.1+ of Umbraco the property value converter is ignored, instead object is the property type.

Reproduction

Clean install of Umbraco 8.2, then add a third party property editor via nuget, either mine: https://www.nuget.org/packages/FontAwesomePropertyEditor/ should return either IEnumerable or FaLink

or Giphy property editor: https://www.nuget.org/packages/GiphyPropertyEditor/ (which should return string, see the source code of the property value converter)

Add a property using one of these editors, run models builder, verify that property is object and not the type declared in the value converter.

Bug summary

Modelsbuilder returning object not strongly typed model for custom property editors.

Specifics

V8.2 - but believe this has been around since 8.1

Steps to reproduce

See above.

Expected result

Strongly typed model

Actual result

Object

dawoe commented 5 years ago

Hey @mjbarlow

There has been a breaking change in 8.1 when it comes to property value converters. So the package developers need to fix it.

I needed to do it for one of my packages as well

https://github.com/dawoe/OEmbed-Picker-Property-Editor/commit/0a3ae22aa4000a64fa2d5fb32b784814baab8f19

Dave

dawoe commented 5 years ago

Hi @mjbarlow

I just checked and this was a breaking change in 8.1 that was not clear from the list of breaking changes in 8.1

If I am correct this is caused by https://github.com/umbraco/Umbraco-CMS/issues/5170

So you will need to fix this in your package.

Dave