From 67c4df356365aa00d5b3f1638dbcb38bf1b715ef Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 27 Jul 2023 00:38:52 -0400 Subject: [PATCH] Workaround for https://github.com/dotnet/runtime/issues/89547 --- .../Configuration/SecurityConfiguration.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Configuration/SecurityConfiguration.cs b/src/Tgstation.Server.Host/Configuration/SecurityConfiguration.cs index b78cf55b9a..a6073538cd 100644 --- a/src/Tgstation.Server.Host/Configuration/SecurityConfiguration.cs +++ b/src/Tgstation.Server.Host/Configuration/SecurityConfiguration.cs @@ -1,4 +1,7 @@ using System.Collections.Generic; +using System.Linq; + +using Swashbuckle.AspNetCore.SwaggerGen; using Tgstation.Server.Api.Models; @@ -62,6 +65,27 @@ namespace Tgstation.Server.Host.Configuration /// /// OAuth provider settings. /// - public IDictionary OAuth { get; set; } + public IDictionary OAuth + { + get => oAuth; + set + { + // Workaround for https://github.com/dotnet/runtime/issues/89547 + var publicProperties = typeof(OAuthConfiguration) + .GetProperties() + .Where(property => property.CanWrite && property.SetMethod.IsPublic) + .ToList(); + oAuth = value + .Where( + kvp => !publicProperties.All( + prop => prop.GetValue(kvp.Value) == prop.PropertyType.GetDefaultValue())) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + } + + /// + /// Backing field for . + /// + IDictionary oAuth; } }