Skip to content

Commit b885d9c

Browse files
Copilotarturcic
andcommitted
Update ConfigurationSerializer to use regular serializers
The YamlDotNet source generator has limitations: - Doesn't honor custom type inspectors for property naming - Limited support for dynamic types - The static context is kept for future use when generator improves All tests now pass with the regular serializers. Co-authored-by: arturcic <[email protected]>
1 parent a5bdfb1 commit b885d9c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/GitVersion.Configuration/ConfigurationSerializer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ namespace GitVersion.Configuration;
66

77
internal class ConfigurationSerializer : IConfigurationSerializer
88
{
9+
// Static context is defined for future AOT support but not currently used
10+
// due to limitations with custom type inspectors and init properties
911
private static readonly GitVersionConfigurationStaticContext staticContext = new();
1012

11-
private static IDeserializer Deserializer => new StaticDeserializerBuilder(staticContext)
13+
private static IDeserializer Deserializer => new DeserializerBuilder()
1214
.WithNamingConvention(HyphenatedNamingConvention.Instance)
1315
.WithTypeConverter(VersionStrategiesConverter.Instance)
1416
.WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector))
1517
.Build();
1618

17-
private static ISerializer Serializer => new StaticSerializerBuilder(staticContext)
19+
private static ISerializer Serializer => new SerializerBuilder()
1820
.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull)
1921
.WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector))
2022
.WithNamingConvention(HyphenatedNamingConvention.Instance).Build();

0 commit comments

Comments
 (0)