From 43e0dfc7c769a4370281cac5696ff8742b968784 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Date: Mon, 8 May 2023 13:20:02 +0200 Subject: [PATCH] Delivery API: Make classes sealed (#14214) * Make implementations sealed and internal if possible * Remove usings * Making some models sealed as well * Making more models sealed * Last model changes * Un-seal ApiContentResponse --------- Co-authored-by: kjac --- .../Configuration/ConfigureApiExplorerOptions.cs | 3 +-- .../ConfigureApiVersioningOptions.cs | 2 +- ...uestContextOutputExpansionStrategyAccessor.cs | 2 +- ...estContextRequestStartItemProviderAccessor.cs | 2 +- .../Filters/DeliveryApiAccessAttribute.cs | 2 +- .../LocalizeFromAcceptLanguageHeaderAttribute.cs | 2 +- .../Json/DeliveryApiJsonTypeResolver.cs | 16 ++++++++-------- .../Querying/QueryOptionBase.cs | 1 - .../VersionedDeliveryApiRouteAttribute.cs | 2 +- .../NoopOutputExpansionStrategyAccessor.cs | 2 +- .../DeliveryApi/ApiContentBuilder.cs | 2 +- .../DeliveryApi/ApiContentNameProvider.cs | 2 +- .../DeliveryApi/ApiContentResponseBuilder.cs | 2 +- .../DeliveryApi/ApiContentRouteBuilder.cs | 2 +- .../DeliveryApi/ApiElementBuilder.cs | 2 +- src/Umbraco.Core/DeliveryApi/ApiMediaBuilder.cs | 2 +- .../DeliveryApi/ApiMediaUrlProvider.cs | 2 +- .../DeliveryApi/ApiPublishedContentCache.cs | 2 +- .../DeliveryApi/ContentIndexHandlerCollection.cs | 2 +- .../ContentIndexHandlerCollectionBuilder.cs | 2 +- .../DeliveryApi/FilterHandlerCollection.cs | 2 +- .../FilterHandlerCollectionBuilder.cs | 2 +- src/Umbraco.Core/DeliveryApi/FilterOption.cs | 2 +- src/Umbraco.Core/DeliveryApi/IndexField.cs | 2 +- src/Umbraco.Core/DeliveryApi/IndexFieldValue.cs | 2 +- .../DeliveryApi/SelectorHandlerCollection.cs | 2 +- .../SelectorHandlerCollectionBuilder.cs | 2 +- src/Umbraco.Core/DeliveryApi/SelectorOption.cs | 2 +- .../DeliveryApi/SortHandlerCollection.cs | 2 +- .../DeliveryApi/SortHandlerCollectionBuilder.cs | 2 +- src/Umbraco.Core/DeliveryApi/SortOption.cs | 2 +- .../Models/DeliveryApi/ApiBlockGridArea.cs | 2 +- .../Models/DeliveryApi/ApiBlockGridItem.cs | 2 +- .../Models/DeliveryApi/ApiBlockGridModel.cs | 2 +- .../Models/DeliveryApi/ApiBlockListModel.cs | 2 +- .../Models/DeliveryApi/ApiContentRoute.cs | 2 +- .../Models/DeliveryApi/ApiContentStartItem.cs | 2 +- src/Umbraco.Core/Models/DeliveryApi/ApiLink.cs | 2 +- src/Umbraco.Core/Models/DeliveryApi/ApiMedia.cs | 2 +- .../Models/DeliveryApi/RichTextElement.cs | 2 +- .../DeliveryApi/ApiRichTextParser.cs | 2 +- .../UmbracoBuilder.CoreServices.cs | 1 - ...iveryApiContentIndexFieldDefinitionBuilder.cs | 2 +- .../Examine/DeliveryApiContentIndexPopulator.cs | 2 +- .../DeliveryApiContentIndexValueSetBuilder.cs | 2 +- .../Models/DeliveryApi/ApiImageCropperValue.cs | 2 +- .../Models/DeliveryApi/ApiMediaWithCrops.cs | 2 +- 47 files changed, 52 insertions(+), 55 deletions(-) diff --git a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiExplorerOptions.cs b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiExplorerOptions.cs index e6093cf29e..86f5bf73ae 100644 --- a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiExplorerOptions.cs +++ b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiExplorerOptions.cs @@ -1,11 +1,10 @@ -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.Extensions.Options; namespace Umbraco.Cms.Api.Common.Configuration; -public class ConfigureApiExplorerOptions : IConfigureOptions +public sealed class ConfigureApiExplorerOptions : IConfigureOptions { private readonly IOptions _apiVersioningOptions; diff --git a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiVersioningOptions.cs b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiVersioningOptions.cs index 928ea3925e..e6aa81f482 100644 --- a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiVersioningOptions.cs +++ b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureApiVersioningOptions.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Options; namespace Umbraco.Cms.Api.Common.Configuration; -public class ConfigureApiVersioningOptions : IConfigureOptions +public sealed class ConfigureApiVersioningOptions : IConfigureOptions { public void Configure(ApiVersioningOptions options) { diff --git a/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextOutputExpansionStrategyAccessor.cs b/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextOutputExpansionStrategyAccessor.cs index 146e356684..cc4bb7933d 100644 --- a/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextOutputExpansionStrategyAccessor.cs +++ b/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextOutputExpansionStrategyAccessor.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.DeliveryApi; namespace Umbraco.Cms.Api.Delivery.Accessors; -public class RequestContextOutputExpansionStrategyAccessor : RequestContextServiceAccessorBase, IOutputExpansionStrategyAccessor +internal sealed class RequestContextOutputExpansionStrategyAccessor : RequestContextServiceAccessorBase, IOutputExpansionStrategyAccessor { public RequestContextOutputExpansionStrategyAccessor(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) diff --git a/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextRequestStartItemProviderAccessor.cs b/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextRequestStartItemProviderAccessor.cs index b993a25f5c..de83331c11 100644 --- a/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextRequestStartItemProviderAccessor.cs +++ b/src/Umbraco.Cms.Api.Delivery/Accessors/RequestContextRequestStartItemProviderAccessor.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.DeliveryApi; namespace Umbraco.Cms.Api.Delivery.Accessors; -public class RequestContextRequestStartItemProviderAccessor : RequestContextServiceAccessorBase, IRequestStartItemProviderAccessor +internal sealed class RequestContextRequestStartItemProviderAccessor : RequestContextServiceAccessorBase, IRequestStartItemProviderAccessor { public RequestContextRequestStartItemProviderAccessor(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs index e67b9eb444..01f0b04074 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.DeliveryApi; namespace Umbraco.Cms.Api.Delivery.Filters; -public class DeliveryApiAccessAttribute : TypeFilterAttribute +internal sealed class DeliveryApiAccessAttribute : TypeFilterAttribute { public DeliveryApiAccessAttribute() : base(typeof(DeliveryApiAccessFilter)) diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/LocalizeFromAcceptLanguageHeaderAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/LocalizeFromAcceptLanguageHeaderAttribute.cs index 7f3d8c2146..7bd2fec9bd 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/LocalizeFromAcceptLanguageHeaderAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/LocalizeFromAcceptLanguageHeaderAttribute.cs @@ -5,7 +5,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Api.Delivery.Filters; -public class LocalizeFromAcceptLanguageHeaderAttribute : TypeFilterAttribute +internal sealed class LocalizeFromAcceptLanguageHeaderAttribute : TypeFilterAttribute { public LocalizeFromAcceptLanguageHeaderAttribute() : base(typeof(LocalizeFromAcceptLanguageHeaderAttributeFilter)) diff --git a/src/Umbraco.Cms.Api.Delivery/Json/DeliveryApiJsonTypeResolver.cs b/src/Umbraco.Cms.Api.Delivery/Json/DeliveryApiJsonTypeResolver.cs index 899ea98380..2de5359a00 100644 --- a/src/Umbraco.Cms.Api.Delivery/Json/DeliveryApiJsonTypeResolver.cs +++ b/src/Umbraco.Cms.Api.Delivery/Json/DeliveryApiJsonTypeResolver.cs @@ -7,19 +7,19 @@ namespace Umbraco.Cms.Api.Delivery.Json; // see https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-7-0 // TODO: if this type resolver is to be used for extendable content models (custom IApiContent implementations) we need to work out an extension model for known derived types -public class DeliveryApiJsonTypeResolver : DefaultJsonTypeInfoResolver +internal sealed class DeliveryApiJsonTypeResolver : DefaultJsonTypeInfoResolver { public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options) { JsonTypeInfo jsonTypeInfo = base.GetTypeInfo(type, options); - if (jsonTypeInfo.Type == typeof(IApiContent)) - { - ConfigureJsonPolymorphismOptions(jsonTypeInfo, typeof(ApiContent)); - } - else if (jsonTypeInfo.Type == typeof(IApiContentResponse)) - { - ConfigureJsonPolymorphismOptions(jsonTypeInfo, typeof(ApiContentResponse)); + if (jsonTypeInfo.Type == typeof(IApiContent)) + { + ConfigureJsonPolymorphismOptions(jsonTypeInfo, typeof(ApiContent)); + } + else if (jsonTypeInfo.Type == typeof(IApiContentResponse)) + { + ConfigureJsonPolymorphismOptions(jsonTypeInfo, typeof(ApiContentResponse)); } return jsonTypeInfo; diff --git a/src/Umbraco.Cms.Api.Delivery/Querying/QueryOptionBase.cs b/src/Umbraco.Cms.Api.Delivery/Querying/QueryOptionBase.cs index daf6d9fe16..8934889715 100644 --- a/src/Umbraco.Cms.Api.Delivery/Querying/QueryOptionBase.cs +++ b/src/Umbraco.Cms.Api.Delivery/Querying/QueryOptionBase.cs @@ -1,4 +1,3 @@ -using System; using Umbraco.Cms.Core.DeliveryApi; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.PublishedCache; diff --git a/src/Umbraco.Cms.Api.Delivery/Routing/VersionedDeliveryApiRouteAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Routing/VersionedDeliveryApiRouteAttribute.cs index 2f9a3f055a..468970cfe1 100644 --- a/src/Umbraco.Cms.Api.Delivery/Routing/VersionedDeliveryApiRouteAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Routing/VersionedDeliveryApiRouteAttribute.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Api.Common.Routing; namespace Umbraco.Cms.Api.Delivery.Routing; -public class VersionedDeliveryApiRouteAttribute : BackOfficeRouteAttribute +internal sealed class VersionedDeliveryApiRouteAttribute : BackOfficeRouteAttribute { public VersionedDeliveryApiRouteAttribute(string template) : base($"delivery/api/v{{version:apiVersion}}/{template.TrimStart('/')}") diff --git a/src/Umbraco.Core/DeliveryApi/Accessors/NoopOutputExpansionStrategyAccessor.cs b/src/Umbraco.Core/DeliveryApi/Accessors/NoopOutputExpansionStrategyAccessor.cs index 4ae4a19260..4b4aad50c0 100644 --- a/src/Umbraco.Core/DeliveryApi/Accessors/NoopOutputExpansionStrategyAccessor.cs +++ b/src/Umbraco.Core/DeliveryApi/Accessors/NoopOutputExpansionStrategyAccessor.cs @@ -2,7 +2,7 @@ namespace Umbraco.Cms.Core.DeliveryApi.Accessors; -public class NoopOutputExpansionStrategyAccessor : IOutputExpansionStrategyAccessor +public sealed class NoopOutputExpansionStrategyAccessor : IOutputExpansionStrategyAccessor { public bool TryGetValue([NotNullWhen(true)] out IOutputExpansionStrategy? outputExpansionStrategy) { diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs index 2082da3a2a..11ea4faf77 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiContentBuilder : ApiContentBuilderBase, IApiContentBuilder +public sealed class ApiContentBuilder : ApiContentBuilderBase, IApiContentBuilder { public ApiContentBuilder(IApiContentNameProvider apiContentNameProvider, IApiContentRouteBuilder apiContentRouteBuilder, IOutputExpansionStrategyAccessor outputExpansionStrategyAccessor) : base(apiContentNameProvider, apiContentRouteBuilder, outputExpansionStrategyAccessor) diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentNameProvider.cs b/src/Umbraco.Core/DeliveryApi/ApiContentNameProvider.cs index f1fa370027..ec4d37ad1e 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentNameProvider.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentNameProvider.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiContentNameProvider : IApiContentNameProvider +public sealed class ApiContentNameProvider : IApiContentNameProvider { public string GetName(IPublishedContent content) => content.Name; } diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs index 0e475aef71..dfa93e55d0 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs @@ -4,7 +4,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiContentResponseBuilder : ApiContentBuilderBase, IApiContentResponseBuilder +public sealed class ApiContentResponseBuilder : ApiContentBuilderBase, IApiContentResponseBuilder { private readonly IApiContentRouteBuilder _apiContentRouteBuilder; diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs index e045ec9d75..34146bf5cf 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs @@ -8,7 +8,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiContentRouteBuilder : IApiContentRouteBuilder +public sealed class ApiContentRouteBuilder : IApiContentRouteBuilder { private readonly IPublishedUrlProvider _publishedUrlProvider; private readonly GlobalSettings _globalSettings; diff --git a/src/Umbraco.Core/DeliveryApi/ApiElementBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiElementBuilder.cs index b2f81b2c9a..c24dde469a 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiElementBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiElementBuilder.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiElementBuilder : IApiElementBuilder +public sealed class ApiElementBuilder : IApiElementBuilder { private readonly IOutputExpansionStrategyAccessor _outputExpansionStrategyAccessor; diff --git a/src/Umbraco.Core/DeliveryApi/ApiMediaBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiMediaBuilder.cs index 53a0968ea0..81c894a635 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiMediaBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiMediaBuilder.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiMediaBuilder : IApiMediaBuilder +public sealed class ApiMediaBuilder : IApiMediaBuilder { private readonly IApiContentNameProvider _apiContentNameProvider; private readonly IApiMediaUrlProvider _apiMediaUrlProvider; diff --git a/src/Umbraco.Core/DeliveryApi/ApiMediaUrlProvider.cs b/src/Umbraco.Core/DeliveryApi/ApiMediaUrlProvider.cs index 4bf3ec9a28..20373b1d3b 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiMediaUrlProvider.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiMediaUrlProvider.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Routing; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiMediaUrlProvider : IApiMediaUrlProvider +public sealed class ApiMediaUrlProvider : IApiMediaUrlProvider { private readonly IPublishedUrlProvider _publishedUrlProvider; diff --git a/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs b/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs index 7773ee7236..5c138dbf7e 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs @@ -6,7 +6,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.DeliveryApi; -public class ApiPublishedContentCache : IApiPublishedContentCache +public sealed class ApiPublishedContentCache : IApiPublishedContentCache { private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; private readonly IRequestPreviewService _requestPreviewService; diff --git a/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollection.cs b/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollection.cs index 1186349997..55326102f4 100644 --- a/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollection.cs +++ b/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollection.cs @@ -2,7 +2,7 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class ContentIndexHandlerCollection : BuilderCollectionBase +public sealed class ContentIndexHandlerCollection : BuilderCollectionBase { public ContentIndexHandlerCollection(Func> items) : base(items) diff --git a/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollectionBuilder.cs b/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollectionBuilder.cs index 625cdbf25e..95744d9a23 100644 --- a/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollectionBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ContentIndexHandlerCollectionBuilder.cs @@ -2,7 +2,7 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class ContentIndexHandlerCollectionBuilder +public sealed class ContentIndexHandlerCollectionBuilder : LazyCollectionBuilderBase { protected override ContentIndexHandlerCollectionBuilder This => this; diff --git a/src/Umbraco.Core/DeliveryApi/FilterHandlerCollection.cs b/src/Umbraco.Core/DeliveryApi/FilterHandlerCollection.cs index 73b4dda3a6..97bdae9619 100644 --- a/src/Umbraco.Core/DeliveryApi/FilterHandlerCollection.cs +++ b/src/Umbraco.Core/DeliveryApi/FilterHandlerCollection.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class FilterHandlerCollection : BuilderCollectionBase +public sealed class FilterHandlerCollection : BuilderCollectionBase { public FilterHandlerCollection(Func> items) : base(items) diff --git a/src/Umbraco.Core/DeliveryApi/FilterHandlerCollectionBuilder.cs b/src/Umbraco.Core/DeliveryApi/FilterHandlerCollectionBuilder.cs index 118b49dfee..76adbfa21e 100644 --- a/src/Umbraco.Core/DeliveryApi/FilterHandlerCollectionBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/FilterHandlerCollectionBuilder.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class FilterHandlerCollectionBuilder +public sealed class FilterHandlerCollectionBuilder : LazyCollectionBuilderBase { protected override FilterHandlerCollectionBuilder This => this; diff --git a/src/Umbraco.Core/DeliveryApi/FilterOption.cs b/src/Umbraco.Core/DeliveryApi/FilterOption.cs index 7f0a979501..5bc3ef0df4 100644 --- a/src/Umbraco.Core/DeliveryApi/FilterOption.cs +++ b/src/Umbraco.Core/DeliveryApi/FilterOption.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class FilterOption +public sealed class FilterOption { public required string FieldName { get; set; } diff --git a/src/Umbraco.Core/DeliveryApi/IndexField.cs b/src/Umbraco.Core/DeliveryApi/IndexField.cs index ff102d1f2c..2df9005131 100644 --- a/src/Umbraco.Core/DeliveryApi/IndexField.cs +++ b/src/Umbraco.Core/DeliveryApi/IndexField.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class IndexField +public sealed class IndexField { public required string FieldName { get; set; } diff --git a/src/Umbraco.Core/DeliveryApi/IndexFieldValue.cs b/src/Umbraco.Core/DeliveryApi/IndexFieldValue.cs index ab3e5bd6db..1e76eff4df 100644 --- a/src/Umbraco.Core/DeliveryApi/IndexFieldValue.cs +++ b/src/Umbraco.Core/DeliveryApi/IndexFieldValue.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class IndexFieldValue +public sealed class IndexFieldValue { public required string FieldName { get; set; } diff --git a/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollection.cs b/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollection.cs index ee97e2e187..06943c3a35 100644 --- a/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollection.cs +++ b/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollection.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class SelectorHandlerCollection : BuilderCollectionBase +public sealed class SelectorHandlerCollection : BuilderCollectionBase { public SelectorHandlerCollection(Func> items) : base(items) diff --git a/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollectionBuilder.cs b/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollectionBuilder.cs index 0af9550915..164da26966 100644 --- a/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollectionBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/SelectorHandlerCollectionBuilder.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class SelectorHandlerCollectionBuilder +public sealed class SelectorHandlerCollectionBuilder : LazyCollectionBuilderBase { protected override SelectorHandlerCollectionBuilder This => this; diff --git a/src/Umbraco.Core/DeliveryApi/SelectorOption.cs b/src/Umbraco.Core/DeliveryApi/SelectorOption.cs index 547267983d..07620032ec 100644 --- a/src/Umbraco.Core/DeliveryApi/SelectorOption.cs +++ b/src/Umbraco.Core/DeliveryApi/SelectorOption.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class SelectorOption +public sealed class SelectorOption { public required string FieldName { get; set; } diff --git a/src/Umbraco.Core/DeliveryApi/SortHandlerCollection.cs b/src/Umbraco.Core/DeliveryApi/SortHandlerCollection.cs index 8878c6336d..77b649d387 100644 --- a/src/Umbraco.Core/DeliveryApi/SortHandlerCollection.cs +++ b/src/Umbraco.Core/DeliveryApi/SortHandlerCollection.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class SortHandlerCollection : BuilderCollectionBase +public sealed class SortHandlerCollection : BuilderCollectionBase { public SortHandlerCollection(Func> items) : base(items) diff --git a/src/Umbraco.Core/DeliveryApi/SortHandlerCollectionBuilder.cs b/src/Umbraco.Core/DeliveryApi/SortHandlerCollectionBuilder.cs index 767d5e59a6..be4189989a 100644 --- a/src/Umbraco.Core/DeliveryApi/SortHandlerCollectionBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/SortHandlerCollectionBuilder.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Composing; namespace Umbraco.Cms.Core.DeliveryApi; -public class SortHandlerCollectionBuilder +public sealed class SortHandlerCollectionBuilder : LazyCollectionBuilderBase { protected override SortHandlerCollectionBuilder This => this; diff --git a/src/Umbraco.Core/DeliveryApi/SortOption.cs b/src/Umbraco.Core/DeliveryApi/SortOption.cs index 5c1ee79418..81670b5641 100644 --- a/src/Umbraco.Core/DeliveryApi/SortOption.cs +++ b/src/Umbraco.Core/DeliveryApi/SortOption.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; -public class SortOption +public sealed class SortOption { public required string FieldName { get; set; } diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridArea.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridArea.cs index 96855849ef..c3ac9155f0 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridArea.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridArea.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiBlockGridArea +public sealed class ApiBlockGridArea { public ApiBlockGridArea(string alias, int rowSpan, int columnSpan, IEnumerable items) { diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridItem.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridItem.cs index 4e84c06f01..8bb026e5df 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridItem.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridItem.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiBlockGridItem : ApiBlockItem +public sealed class ApiBlockGridItem : ApiBlockItem { public ApiBlockGridItem(IApiElement content, IApiElement? settings, int rowSpan, int columnSpan, int areaGridColumns, IEnumerable areas) : base(content, settings) diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridModel.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridModel.cs index 2b1887b18d..9fcd280082 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridModel.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockGridModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiBlockGridModel +public sealed class ApiBlockGridModel { public ApiBlockGridModel(int gridColumns, IEnumerable items) { diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockListModel.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockListModel.cs index caa0002899..8cf64909a5 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiBlockListModel.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiBlockListModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiBlockListModel +public sealed class ApiBlockListModel { public ApiBlockListModel(IEnumerable items) => Items = items; diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiContentRoute.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiContentRoute.cs index 7e15ea6696..45fcaaba4b 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiContentRoute.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiContentRoute.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiContentRoute : IApiContentRoute +public sealed class ApiContentRoute : IApiContentRoute { public ApiContentRoute(string path, ApiContentStartItem startItem) { diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiContentStartItem.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiContentStartItem.cs index 5a7f2b7082..96a9b49642 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiContentStartItem.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiContentStartItem.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiContentStartItem : IApiContentStartItem +public sealed class ApiContentStartItem : IApiContentStartItem { public ApiContentStartItem(Guid id, string path) { diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiLink.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiLink.cs index 1b0acef86a..d255f6ab32 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiLink.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiLink.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiLink +public sealed class ApiLink { public static ApiLink Content(string title, string? target, Guid destinationId, string destinationType, IApiContentRoute route) => new(LinkType.Content, null, title, target, destinationId, destinationType, route); diff --git a/src/Umbraco.Core/Models/DeliveryApi/ApiMedia.cs b/src/Umbraco.Core/Models/DeliveryApi/ApiMedia.cs index 7ad66f313e..df076f50a3 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/ApiMedia.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/ApiMedia.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiMedia : IApiMedia +public sealed class ApiMedia : IApiMedia { public ApiMedia(Guid id, string name, string mediaType, string url, IDictionary properties) { diff --git a/src/Umbraco.Core/Models/DeliveryApi/RichTextElement.cs b/src/Umbraco.Core/Models/DeliveryApi/RichTextElement.cs index 3f33b4364f..b3d06be98c 100644 --- a/src/Umbraco.Core/Models/DeliveryApi/RichTextElement.cs +++ b/src/Umbraco.Core/Models/DeliveryApi/RichTextElement.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class RichTextElement +public sealed class RichTextElement { public RichTextElement(string tag, string text, Dictionary attributes, IEnumerable elements) { diff --git a/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextParser.cs b/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextParser.cs index e2b3a59f8f..8c56afd6e9 100644 --- a/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextParser.cs +++ b/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextParser.cs @@ -11,7 +11,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.DeliveryApi; -public partial class ApiRichTextParser : IApiRichTextParser +internal sealed partial class ApiRichTextParser : IApiRichTextParser { private readonly IApiContentRouteBuilder _apiContentRouteBuilder; private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs index d285cbbcbd..73b4b9f87a 100644 --- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs +++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs @@ -58,7 +58,6 @@ using Umbraco.Cms.Infrastructure.Search; using Umbraco.Cms.Infrastructure.Serialization; using Umbraco.Cms.Infrastructure.Services.Implement; using Umbraco.Extensions; -using ApiRichTextParser = Umbraco.Cms.Infrastructure.DeliveryApi.ApiRichTextParser; using IScopeProvider = Umbraco.Cms.Infrastructure.Scoping.IScopeProvider; namespace Umbraco.Cms.Infrastructure.DependencyInjection; diff --git a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexFieldDefinitionBuilder.cs b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexFieldDefinitionBuilder.cs index 8b4094f493..e4bd1710f9 100644 --- a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexFieldDefinitionBuilder.cs +++ b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexFieldDefinitionBuilder.cs @@ -4,7 +4,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Examine; -public class DeliveryApiContentIndexFieldDefinitionBuilder : IDeliveryApiContentIndexFieldDefinitionBuilder +internal sealed class DeliveryApiContentIndexFieldDefinitionBuilder : IDeliveryApiContentIndexFieldDefinitionBuilder { private readonly ContentIndexHandlerCollection _contentIndexHandlerCollection; diff --git a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexPopulator.cs index 91bd3dba26..47080971f8 100644 --- a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexPopulator.cs +++ b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexPopulator.cs @@ -10,7 +10,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Examine; -public class DeliveryApiContentIndexPopulator : IndexPopulator +internal sealed class DeliveryApiContentIndexPopulator : IndexPopulator { private readonly IContentService _contentService; private readonly IUmbracoDatabaseFactory _umbracoDatabaseFactory; diff --git a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexValueSetBuilder.cs index 8b62a8507d..87d0bbf9fa 100644 --- a/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexValueSetBuilder.cs +++ b/src/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexValueSetBuilder.cs @@ -9,7 +9,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Examine; -public class DeliveryApiContentIndexValueSetBuilder : IDeliveryApiContentIndexValueSetBuilder +internal sealed class DeliveryApiContentIndexValueSetBuilder : IDeliveryApiContentIndexValueSetBuilder { private readonly ContentIndexHandlerCollection _contentIndexHandlerCollection; private readonly IScopeProvider _scopeProvider; diff --git a/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiImageCropperValue.cs b/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiImageCropperValue.cs index 7e64f41665..5cb6ee535e 100644 --- a/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiImageCropperValue.cs +++ b/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiImageCropperValue.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.PropertyEditors.ValueConverters; namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiImageCropperValue +internal sealed class ApiImageCropperValue { public ApiImageCropperValue(string url, ImageCropperValue.ImageCropperFocalPoint? focalPoint, IEnumerable? crops) { diff --git a/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiMediaWithCrops.cs b/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiMediaWithCrops.cs index 239108f416..6315766a1c 100644 --- a/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiMediaWithCrops.cs +++ b/src/Umbraco.Infrastructure/Models/DeliveryApi/ApiMediaWithCrops.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.PropertyEditors.ValueConverters; namespace Umbraco.Cms.Core.Models.DeliveryApi; -public class ApiMediaWithCrops : IApiMedia +internal sealed class ApiMediaWithCrops : IApiMedia { private readonly IApiMedia _inner;