oneof.proto 755 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. syntax = "proto3";
  2. import 'nanopb.proto';
  3. // Repeated callback inside submessage inside oneof
  4. message SubMsg1
  5. {
  6. repeated int32 array = 1;
  7. }
  8. // String callback inside submessage inside oneof
  9. message SubMsg2
  10. {
  11. string strvalue = 1;
  12. }
  13. // String callback directly inside oneof
  14. message SubMsg3
  15. {
  16. oneof values
  17. {
  18. int32 intvalue = 1;
  19. string strvalue = 2 [(nanopb).callback_datatype = "const char*"];
  20. }
  21. }
  22. message OneOfMessage
  23. {
  24. option (nanopb_msgopt).submsg_callback = true;
  25. int32 prefix = 1;
  26. oneof values
  27. {
  28. int32 intvalue = 5;
  29. string strvalue = 6 [(nanopb).max_size = 8];
  30. SubMsg1 submsg1 = 7;
  31. SubMsg2 submsg2 = 8;
  32. SubMsg3 submsg3 = 9;
  33. }
  34. int32 suffix = 99;
  35. }