-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
When adding a new enum value that contains a number after the prefix, generated enums names will change to use the full "ENUM_PREFIX_NAME" style rather than the "Prefix.Name" value style.
Observed with both buf.build/bufbuild/es:v2.2.0 and current buf.build/bufbuild/es:v2.10.0, did not test in between versions.
Example:
Start with minimum basic enum:
syntax = "proto3";
package enum.test.v1;
enum ActionType {
ACTION_TYPE_INVALID = 0;
ACTION_TYPE_ONE = 1;
}
Results in this being generated:
/**
* @generated from enum enum.test.v1.ActionType
*/
export enum ActionType {
/**
* @generated from enum value: ACTION_TYPE_INVALID = 0;
*/
INVALID = 0,
/**
* @generated from enum value: ACTION_TYPE_ONE = 1;
*/
ONE = 1,
}Add a new enum value containing a number:
syntax = "proto3";
package enum.test.v1;
enum ActionType {
ACTION_TYPE_INVALID = 0;
ACTION_TYPE_ONE = 1;
ACTION_TYPE_2 = 2;
}
Notice all of the generated values change format:
/**
* @generated from enum enum.test.v1.ActionType
*/
export enum ActionType {
/**
* @generated from enum value: ACTION_TYPE_INVALID = 0;
*/
ACTION_TYPE_INVALID = 0,
/**
* @generated from enum value: ACTION_TYPE_ONE = 1;
*/
ACTION_TYPE_ONE = 1,
/**
* @generated from enum value: ACTION_TYPE_2 = 2;
*/
ACTION_TYPE_2 = 2,
}I know this is a bad example, since you shouldn't mix enum name styles in proto to begin with, but we recently had a somewhat justified reason for doing so and were surprised by a breaking change in our generated code, despite breaking change detection on the proto itself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels