diff --git a/utils/generate_dotnet_channels.js b/utils/generate_dotnet_channels.js index 979604faf8c83..b6f0b7716e7bd 100644 --- a/utils/generate_dotnet_channels.js +++ b/utils/generate_dotnet_channels.js @@ -144,7 +144,10 @@ function properties(properties, indent, onlyOptional, parentName, level) { continue; ts.push(''); ts.push(`${indent}[JsonPropertyName("${name}")]`); - ts.push(`${indent}public ${inner.ts}${nullableSuffix(inner)} ${toTitleCase(name)} { get; set; }`); + let suffix = '' + if (!['bool', 'int', 'System.Text.Json.JsonElement'].includes(inner.ts)) + suffix = ' = null!;' + ts.push(`${indent}public ${inner.ts}${nullableSuffix(inner)} ${toTitleCase(name)} { get; set; }${suffix}`); const wrapped = inner.optional ? `tOptional(${inner.scheme})` : inner.scheme; scheme.push(`${indent}${name}: ${wrapped},`); }