Merge branch 'contrib' into v12/dev

This commit is contained in:
Sebastiaan Janssen
2023-09-05 10:09:02 +02:00
3 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
using System.Text.Json.Serialization;
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public class ApiElement : IApiElement
@@ -11,6 +13,9 @@ public class ApiElement : IApiElement
public Guid Id { get; }
// Ensure the ContentType property is serialized first
// This is needed so it can be used as a discriminator field by System.Text.Json
[JsonPropertyOrder(-100)]
public string ContentType { get; }
public IDictionary<string, object?> Properties { get; }

View File

@@ -1,9 +1,14 @@
using System.Text.Json.Serialization;
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public interface IApiElement
{
Guid Id { get; }
// Ensure the ContentType property is serialized first
// This is needed so it can be used as a discriminator field by System.Text.Json
[JsonPropertyOrder(-100)]
string ContentType { get; }
IDictionary<string, object?> Properties { get; }

View File

@@ -113,7 +113,7 @@ public class BlockListPropertyValueConverter : BlockPropertyValueConverterBase<B
/// <inheritdoc />
public Type GetDeliveryApiPropertyValueType(IPublishedPropertyType propertyType)
=> typeof(IEnumerable<ApiBlockListModel>);
=> typeof(ApiBlockListModel);
/// <inheritdoc />
public object? ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview, bool expanding)