unittest_preserve_unknown_enum2.proto 890 B

123456789101112131415161718192021222324252627282930313233
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. //
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file or at
  6. // https://developers.google.com/open-source/licenses/bsd
  7. edition = "2023";
  8. package proto2_preserve_unknown_enum_unittest;
  9. // Treat all enums as closed and use expanded encoding for repeated fields by
  10. // default (proto2 behavior).
  11. option features.enum_type = CLOSED;
  12. option features.repeated_field_encoding = EXPANDED;
  13. enum MyEnum {
  14. FOO = 0;
  15. BAR = 1;
  16. BAZ = 2;
  17. }
  18. message MyMessage {
  19. MyEnum e = 1;
  20. repeated MyEnum repeated_e = 2;
  21. repeated MyEnum repeated_packed_e = 3
  22. [features.repeated_field_encoding = PACKED];
  23. repeated MyEnum repeated_packed_unexpected_e = 4; // not packed
  24. oneof o {
  25. MyEnum oneof_e_1 = 5;
  26. MyEnum oneof_e_2 = 6;
  27. }
  28. }