unittest_swift_enum_optional_default.proto 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Protos/unittest_swift_enum_optional_default.proto - test proto
  2. //
  3. // This source file is part of the Swift.org open source project
  4. //
  5. // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
  6. // Licensed under Apache License v2.0 with Runtime Library Exception
  7. //
  8. // See http://swift.org/LICENSE.txt for license information
  9. // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
  10. //
  11. // -----------------------------------------------------------------------------
  12. ///
  13. /// Test handling of enum fields with specified defaults
  14. ///
  15. // -----------------------------------------------------------------------------
  16. syntax = "proto2";
  17. package protobuf_unittest.extend;
  18. message EnumOptionalDefault {
  19. message NestedMessage {
  20. enum Enum {
  21. FOO = 0;
  22. }
  23. // The circular reference here forces the generator to
  24. // implement heap-backed storage.
  25. optional NestedMessage message = 1;
  26. optional Enum optional_enum = 17 [default = FOO];
  27. }
  28. message NestedMessage2 {
  29. enum Enum {
  30. FOO = 0;
  31. }
  32. optional Enum optional_enum = 17 [default = FOO];
  33. }
  34. }