From 65638581071f98c3eceba65980e9edf673ca9b33 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sat, 4 Jan 2025 17:48:45 -0600 Subject: [PATCH] Add NET9. Evaluate JsonStringEnumMemberNameAttribute. --- src/KubeOps.Transpiler/Crds.cs | 6 ++++++ src/KubeOps.Transpiler/KubeOps.Transpiler.csproj | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/KubeOps.Transpiler/Crds.cs b/src/KubeOps.Transpiler/Crds.cs index a188675f..40b924f7 100644 --- a/src/KubeOps.Transpiler/Crds.cs +++ b/src/KubeOps.Transpiler/Crds.cs @@ -352,6 +352,12 @@ private static IList GetEnumNames(this MetadataLoadContext context, Type { attributeNameByFieldName.Add(field.Name, enumMemberAtribute.Value); } +#if NET9_0_OR_GREATER + if (field.GetCustomAttribute() is { Name: not null } jsonMemberNameAtribute) + { + attributeNameByFieldName.Add(field.Name, jsonMemberNameAtribute.Name); + } +#endif } var enumName = new List(); diff --git a/src/KubeOps.Transpiler/KubeOps.Transpiler.csproj b/src/KubeOps.Transpiler/KubeOps.Transpiler.csproj index a71a5557..25af1db5 100644 --- a/src/KubeOps.Transpiler/KubeOps.Transpiler.csproj +++ b/src/KubeOps.Transpiler/KubeOps.Transpiler.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0;net8.0 + net6.0;net7.0;net8.0;net9.0