protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Support disabling/overriding ConvertToCamelCase

Open Rohansi opened this issue 2 years ago • 2 comments

I upgraded to the new source generator version of this and it is no longer valid to write a protobuf message for Unity engine types like Vector3.

//:namespace = UnityEngine
//:type = struct
//:external
message Vector3 {
	optional float x = 1 [default = 0];
	optional float y = 2 [default = 0];
	optional float z = 3 [default = 0];
}

Unity does not use camel case for Vector3 fields so, after upgrading, there is no way to make this work because the source generator doesn't allow ConvertToCamelCase to be disabled and I can't go and change Unity builtin types.

Rohansi avatar Mar 07 '23 18:03 Rohansi

Would a custom NuGet package with ConvertToCamelCase set to false be an option? Or perhaps a per message option like //:case = none?

hultqvist avatar Mar 14 '23 19:03 hultqvist

Per-message option sounds good for special cases like this. I agree that converting to camel case is a good default because that's C# style but it's unfortunate that Unity doesn't follow that.

Rohansi avatar Mar 16 '23 15:03 Rohansi