diff --git a/Cognite.Config/Configuration.cs b/Cognite.Config/Configuration.cs index 1bf69654..5fbb60d3 100644 --- a/Cognite.Config/Configuration.cs +++ b/Cognite.Config/Configuration.cs @@ -414,6 +414,7 @@ public static string ConfigToString( toAlwaysKeep, toIgnore, namePrefixes, + converters, allowReadOnly)) .WithNamingConvention(HyphenatedNamingConvention.Instance); @@ -503,6 +504,7 @@ internal class DefaultFilterTypeInspector : TypeInspectorSkeleton private readonly HashSet _toAlwaysKeep; private readonly HashSet _toIgnore; private readonly IEnumerable _namePrefixes; + private readonly IEnumerable _customConverters; private readonly bool _allowReadOnly; /// /// Constructor @@ -511,12 +513,14 @@ internal class DefaultFilterTypeInspector : TypeInspectorSkeleton /// Fields to always keep /// Fields to exclude /// Prefixes on full type names for types that should be explored internally + /// List of registered custom converters. /// Allow read only properties public DefaultFilterTypeInspector( ITypeInspector innerTypeDescriptor, IEnumerable toAlwaysKeep, IEnumerable toIgnore, IEnumerable namePrefixes, + IEnumerable customConverters, bool allowReadOnly) { _innerTypeDescriptor = innerTypeDescriptor; @@ -524,6 +528,7 @@ public DefaultFilterTypeInspector( _toIgnore = new HashSet(toIgnore); _namePrefixes = namePrefixes; _allowReadOnly = allowReadOnly; + _customConverters = customConverters; } /// @@ -558,7 +563,10 @@ public override IEnumerable GetProperties(Type type, object var val = prop?.GetValue(container); if (val != null && prop != null && !type.IsValueType - && _namePrefixes.Any(prefix => prop.PropertyType.FullName!.StartsWith(prefix, StringComparison.InvariantCulture))) + && _namePrefixes.Any(prefix => prop.PropertyType.FullName!.StartsWith(prefix, StringComparison.InvariantCulture)) + // Any type covered by a custom converter shouldn't be passed through here. We don't know + // how those are serialized, it is likely not just by listing their properties. + && _customConverters.All(conv => !conv.Accepts(prop.PropertyType))) { var pr = GetProperties(prop.PropertyType, val); if (!pr.Any()) return false; diff --git a/version b/version index e4a973f9..ae96cc73 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.24.2 +1.24.3