Skip to content

Commit d446b74

Browse files
committed
Fix AOT deserialization
1 parent 69a2567 commit d446b74

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information
44

55
using Elastic.Documentation.Configuration.Assembler;
6+
using Elastic.Documentation.Configuration.Versions;
67
using YamlDotNet.Serialization;
78

89
namespace Elastic.Documentation.Configuration.Serialization;
@@ -15,4 +16,6 @@ namespace Elastic.Documentation.Configuration.Serialization;
1516
[YamlSerializable(typeof(GoogleTagManager))]
1617
[YamlSerializable(typeof(ContentSource))]
1718
[YamlSerializable(typeof(VersionEntry))]
19+
[YamlSerializable(typeof(VersionsConfigDto))]
20+
[YamlSerializable(typeof(VersioningSystemDto))]
1821
public partial class YamlStaticContext;

src/Elastic.Documentation.Configuration/Versions/VersionsConfigurationExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using Elastic.Documentation.Configuration.Serialization;
56
using Microsoft.Extensions.DependencyInjection;
67
using Microsoft.Extensions.Options;
78
using YamlDotNet.Serialization;
@@ -19,7 +20,7 @@ public static IServiceCollection AddVersions(this IServiceCollection services)
1920
using var stream = assembly.GetManifestResourceStream(ResourceName) ?? throw new FileNotFoundException(ResourceName);
2021
using var reader = new StreamReader(stream);
2122

22-
var deserializer = new DeserializerBuilder()
23+
var deserializer = new StaticDeserializerBuilder(new YamlStaticContext())
2324
.WithNamingConvention(UnderscoredNamingConvention.Instance)
2425
.Build();
2526

0 commit comments

Comments
 (0)