Updates to Core.Configuration Models to use DefaultValue attribute to allow auto generated JSONSchema to give a default value in schema

This commit is contained in:
Warren Buckley
2021-07-05 14:27:49 +01:00
parent cd36d050c5
commit 6b73ea767f
28 changed files with 372 additions and 106 deletions

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,6 +12,16 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigWebRouting)]
public class WebRoutingSettings
{
internal const bool StaticTryMatchingEndpointsForAllPages = false;
internal const bool StaticTrySkipIisCustomErrors = false;
internal const bool StaticInternalRedirectPreservesTemplate = false;
internal const bool StaticDisableAlternativeTemplates = false;
internal const bool StaticValidateAlternativeTemplates = false;
internal const bool StaticDisableFindContentByIdPath = false;
internal const bool StaticDisableRedirectUrlTracking = false;
internal const string StaticUrlProviderMode = "Auto";
/// <summary>
/// Gets or sets a value indicating whether to check if any routed endpoints match a front-end request before
/// the Umbraco dynamic router tries to map the request to an Umbraco content item.
@@ -20,42 +31,50 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// ASP.NET Core will automatically handle this in all cases. This is more of a backward compatible option since this is what v7/v8 used
/// to do.
/// </remarks>
public bool TryMatchingEndpointsForAllPages { get; set; } = false;
[DefaultValue(StaticTryMatchingEndpointsForAllPages)]
public bool TryMatchingEndpointsForAllPages { get; set; } = StaticTryMatchingEndpointsForAllPages;
/// <summary>
/// Gets or sets a value indicating whether IIS custom errors should be skipped.
/// </summary>
public bool TrySkipIisCustomErrors { get; set; } = false;
[DefaultValue(StaticTrySkipIisCustomErrors)]
public bool TrySkipIisCustomErrors { get; set; } = StaticTrySkipIisCustomErrors;
/// <summary>
/// Gets or sets a value indicating whether an internal redirect should preserve the template.
/// </summary>
public bool InternalRedirectPreservesTemplate { get; set; } = false;
[DefaultValue(StaticInternalRedirectPreservesTemplate)]
public bool InternalRedirectPreservesTemplate { get; set; } = StaticInternalRedirectPreservesTemplate;
/// <summary>
/// Gets or sets a value indicating whether the use of alternative templates are disabled.
/// </summary>
public bool DisableAlternativeTemplates { get; set; } = false;
[DefaultValue(StaticDisableAlternativeTemplates)]
public bool DisableAlternativeTemplates { get; set; } = StaticDisableAlternativeTemplates;
/// <summary>
/// Gets or sets a value indicating whether the use of alternative templates should be validated.
/// </summary>
public bool ValidateAlternativeTemplates { get; set; } = false;
[DefaultValue(StaticValidateAlternativeTemplates)]
public bool ValidateAlternativeTemplates { get; set; } = StaticValidateAlternativeTemplates;
/// <summary>
/// Gets or sets a value indicating whether find content ID by path is disabled.
/// </summary>
public bool DisableFindContentByIdPath { get; set; } = false;
[DefaultValue(StaticDisableFindContentByIdPath)]
public bool DisableFindContentByIdPath { get; set; } = StaticDisableFindContentByIdPath;
/// <summary>
/// Gets or sets a value indicating whether redirect URL tracking is disabled.
/// </summary>
public bool DisableRedirectUrlTracking { get; set; } = false;
[DefaultValue(StaticDisableRedirectUrlTracking)]
public bool DisableRedirectUrlTracking { get; set; } = StaticDisableRedirectUrlTracking;
/// <summary>
/// Gets or sets a value for the URL provider mode (<see cref="UrlMode"/>).
/// </summary>
public UrlMode UrlProviderMode { get; set; } = UrlMode.Auto;
[DefaultValue(StaticUrlProviderMode)]
public UrlMode UrlProviderMode { get; set; } = Enum<UrlMode>.Parse(StaticUrlProviderMode);
/// <summary>
/// Gets or sets a value for the Umbraco application URL.