V14: Remove Newtonsoft from packed projects (#15811)

* Migrate ObjectJsonExtensions

* Use more generic exception to not use Newtonsoft

It should matter if it's a JsonReaderException, if we can't read we can't read

* Remove obsoleted constructors

* Use more generic exception in ContentValueSetBuilder

* Fix constructors

* Remove UdiRangeJsonConverter

* Remove more legacy newtonsoft stuff

* Migrate away from newtonsoft in CacheInstructionService

* Remove unused model binders

* Remove more newtonsoft

* Remove newtonsoft from DatabaseServerMessenger

* Remove now irrelevant benchmark

* Remove the usage of Newtonsoft from ImageCropperTemplateCoreExtensions

The value converter will never return JObject, JsonDocument, or JsonNode

* Remove usages of newtonsoft in ComplexPropertyEditorContentNotificationHandler

JTokens are no longer returned, so we don't need to check for it

* Remove newtonsoft references

* Re-add newtonsoft dependency to Umbraco.Tests.Common

* Fix package references

* move dependency

---------

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Mole
2024-03-01 12:51:21 +01:00
committed by GitHub
parent 2080fd5524
commit 9cb1d66b10
22 changed files with 61 additions and 194 deletions

View File

@@ -1,8 +1,6 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
@@ -55,17 +53,13 @@ public abstract class ComplexPropertyEditorContentNotificationHandler :
foreach (IPropertyValue cultureVal in propVals)
{
// Remove keys from published value & any nested properties
var publishedValue = cultureVal.PublishedValue is JToken jsonPublishedValue
? jsonPublishedValue.ToString(Formatting.None)
: cultureVal.PublishedValue?.ToString();
var publishedValue = cultureVal.PublishedValue?.ToString();
var updatedPublishedVal =
FormatPropertyValue(publishedValue!, onlyMissingKeys).NullOrWhiteSpaceAsNull();
cultureVal.PublishedValue = updatedPublishedVal;
// Remove keys from edited/draft value & any nested properties
var editedValue = cultureVal.EditedValue is JToken jsonEditedValue
? jsonEditedValue.ToString(Formatting.None)
: cultureVal.EditedValue?.ToString();
var editedValue = cultureVal.EditedValue?.ToString();
var updatedEditedVal = FormatPropertyValue(editedValue!, onlyMissingKeys).NullOrWhiteSpaceAsNull();
cultureVal.EditedValue = updatedEditedVal;
}