Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion generators/csharp/base/src/proto/CsharpProtobufTypeMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,9 @@ function getValueForLiteral({ literal }: { literal: Literal }, csharp: CSharp):
/*
* Protobuf enums remove the stutter in their generated enum value names.
* For example, the enum value `Status.StatusActive` becomes `Status.Active`.
*
* If the resulting name starts with a digit, protobuf's C# codegen prepends
* an underscore (e.g., `VIDEO_ASPECT_RATIO_1_1` becomes `_11`).
*/
function getProtobufEnumValueName({
generation,
Expand All @@ -994,5 +997,9 @@ function getProtobufEnumValueName({
enumValue: EnumValue;
}): string {
const enumValueName = enumValue.name.name.pascalCase.safeName;
return enumValueName.replace(classReference.name, "");
const stripped = enumValueName.replace(classReference.name, "");
if (/^\d/.test(stripped)) {
return `_${stripped}`;
}
return stripped;
}
8 changes: 8 additions & 0 deletions generators/csharp/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
- version: 2.30.1
changelogEntry:
- summary: |
Fix gRPC code generation to support enums with numeric identifiers.
type: fix
createdAt: "2026-03-13"
irVersion: 65

- version: 2.30.0
changelogEntry:
- summary: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "string",
"enum": [
"ASPECT_RATIO_UNSPECIFIED",
"ASPECT_RATIO_1_1",
"ASPECT_RATIO_16_9",
"ASPECT_RATIO_9_16",
"ASPECT_RATIO_4_3"
],
"definitions": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "string",
"enum": [
"INDEX_TYPE_INVALID",
"INDEX_TYPE_DEFAULT",
"INDEX_TYPE_STRICT"
],
"definitions": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"index_type": {
"oneOf": [
{
"$ref": "#/definitions/dataservice.IndexType"
"$ref": "#/definitions/IndexType"
},
{
"type": "null"
Expand All @@ -37,7 +37,7 @@
{
"type": "array",
"items": {
"$ref": "#/definitions/dataservice.IndexType"
"$ref": "#/definitions/IndexType"
}
},
{
Expand All @@ -48,7 +48,7 @@
},
"additionalProperties": false,
"definitions": {
"dataservice.IndexType": {
"IndexType": {
"type": "string",
"enum": [
"INDEX_TYPE_INVALID",
Expand Down
Loading
Loading