Further NRT updates for Deploy (#12375)

* Nullability modifications to grid cell values and connector.

* Nullable updates to IDataTypeConfigurationConnector.

* Apply suggestions from code review

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
(cherry picked from commit 109d2f191e)
This commit is contained in:
Andy Butland
2022-05-06 18:04:26 +02:00
committed by Bjarke Berg
parent ea77c9a4fc
commit 5810c2d35b
5 changed files with 9 additions and 9 deletions

View File

@@ -22,13 +22,13 @@ namespace Umbraco.Cms.Core.Deploy
/// </summary>
/// <param name="dataType">The datatype.</param>
/// <param name="dependencies">The dependencies.</param>
string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies);
string? ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies);
/// <summary>
/// Gets the actual datatype configuration corresponding to the artifact configuration.
/// </summary>
/// <param name="dataType">The datatype.</param>
/// <param name="configuration">The artifact configuration.</param>
object FromArtifact(IDataType dataType, string configuration);
object? FromArtifact(IDataType dataType, string? configuration);
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
namespace Umbraco.Cms.Core.Deploy
@@ -25,7 +25,7 @@ namespace Umbraco.Cms.Core.Deploy
/// <param name="dependencies">The dependencies of the property.</param>
/// <returns>The grid cell value to be deployed.</returns>
/// <remarks>Note that </remarks>
string GetValue(GridValue.GridControl gridControl, ICollection<ArtifactDependency> dependencies);
string? GetValue(GridValue.GridControl gridControl, ICollection<ArtifactDependency> dependencies);
/// <summary>
/// Allows you to modify the value of a control being deployed.

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -63,7 +63,7 @@ namespace Umbraco.Cms.Core.Models
public class GridControl
{
[JsonProperty("value")]
public JToken Value { get; set; } = null!;
public JToken? Value { get; set; }
[JsonProperty("editor")]
public GridEditor Editor { get; set; } = null!;

View File

@@ -300,8 +300,8 @@ namespace Umbraco.Cms.Core.PropertyEditors
if (mediaValues is not null)
{
foreach (var umbracoEntityReference in mediaValues.Where(x => x.Value.HasValues)
.SelectMany(x => _mediaPickerPropertyValueEditor.GetReferences(x.Value["udi"])))
foreach (var umbracoEntityReference in mediaValues.Where(x => x.Value?.HasValues ?? false)
.SelectMany(x => _mediaPickerPropertyValueEditor.GetReferences(x.Value!["udi"])))
{
yield return umbracoEntityReference;
}

View File

@@ -57,7 +57,7 @@ namespace Umbraco.Cms.Infrastructure.Templates
foreach (var macroGridControl in macroGridControls)
{
// Deserialise JSON of Macro Grid Control to a class
var gridMacro = macroGridControl.Value.ToObject<GridMacro>();
var gridMacro = macroGridControl.Value?.ToObject<GridMacro>();
// Collect any macro parameters that contain the media udi format
if (gridMacro is not null && gridMacro.MacroParameters is not null && gridMacro.MacroParameters.Any())
{