buf: Changing an enum field to an identical type is considered breaking WIRE change

Before:

message Bar {
  enum Foo {
    FOO_UNSPECIFIED = 0;
    FOO_A = 1;
  }
  Foo field = 1;
}

After:

enum Foo {
  FOO_UNSPECIFIED = 0;
  FOO_A = 1;
}

message Bar {
  Foo field = 1;
}

This is currently detected as a breaking change with a message like:

Field "1" on message "Bar" changed type from "Bar.Foo" to "Foo".

This is not actually a breaking change in the wire format as the enum values are the same even if the type has changed name.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

This is done in #400 and will go out in the next release.

Hmmm… this would definitely need to be something that is configurable because all things that were mentioned here are breaking changes for the generated code. Switching from i32 to i64 would for instance translate to Int and Long in Kotlin or i32 and i64 in Rust, while being compatible, the code in question breaks if we are not going to regenerate, update all usages, and release. Otherwise 9223372036854775807 will overflow and end up as -1.

Yea I think we’re gonna close this one for now, but if it comes up again we’ll revisit. Thanks for the input though, appreciate it.