diff --git a/src/K8sOperator.NET.Generators/Builders/CustomResourceDefinitionBuilderExtensions.cs b/src/K8sOperator.NET.Generators/Builders/CustomResourceDefinitionBuilderExtensions.cs index 6c252b9..b1972c5 100644 --- a/src/K8sOperator.NET.Generators/Builders/CustomResourceDefinitionBuilderExtensions.cs +++ b/src/K8sOperator.NET.Generators/Builders/CustomResourceDefinitionBuilderExtensions.cs @@ -219,9 +219,10 @@ public static TBuilder OfType(this TBuilder builder, string type) /// The type of the builder. /// The builder instance. /// The type of the schema property. + /// /// The configured builder. /// Thrown when the provided type is not valid. - public static TBuilder OfType(this TBuilder builder, Type type) + public static TBuilder OfType(this TBuilder builder, Type type, bool? nullable = false) where TBuilder : IKubernetesObjectBuilder { if (type.FullName == "System.String") @@ -229,14 +230,44 @@ public static TBuilder OfType(this TBuilder builder, Type type) builder.Add(x => { x.Type = "string"; - x.Nullable = false; + x.Nullable = nullable; + }); + return builder; + } + + if (type.FullName == "System.Int32") + { + builder.Add(x => + { + x.Type = "integer"; + x.Nullable = nullable; + }); + return builder; + } + + if (type.FullName == "System.Int64") + { + builder.Add(x => + { + x.Type = "integer"; + x.Nullable = nullable; + }); + return builder; + } + + if (type.FullName == "System.Boolean") + { + builder.Add(x => + { + x.Type = "boolean"; + x.Nullable = nullable; }); return builder; } if (type.Name == typeof(Nullable<>).Name && type.GenericTypeArguments.Length == 1) { - return builder.OfType(type.GenericTypeArguments[0]); + return builder.OfType(type.GenericTypeArguments[0], true); } return type.BaseType?.FullName switch