testproto.proto 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. syntax = "proto2";
  2. import 'nanopb.proto';
  3. message SubMessage
  4. {
  5. repeated int32 array = 1 [(nanopb).max_count = 8];
  6. }
  7. message OneOfMessage
  8. {
  9. required int32 prefix = 1;
  10. oneof values
  11. {
  12. int32 first = 5;
  13. string second = 6 [(nanopb).max_length = 8];
  14. SubMessage third = 7;
  15. }
  16. required int32 suffix = 99;
  17. }
  18. message topMessage {
  19. required int32 start = 1;
  20. oneof msg {
  21. MyMessage1 msg1 = 2;
  22. MyMessage2 msg2 = 3;
  23. }
  24. required int32 end = 4;
  25. }
  26. message MyMessage1 {
  27. required uint32 n1 = 1;
  28. required uint32 n2 = 2;
  29. required string s = 3 [(nanopb).max_length = 32];
  30. }
  31. message MyMessage2 {
  32. required uint32 num = 1;
  33. required bool b = 2;
  34. }
  35. message MyMessage3 {
  36. required bool bbb = 1;
  37. required string ss = 2 [(nanopb).max_length = 1];
  38. }
  39. message MyMessage4 {
  40. required bool bbbb = 1;
  41. required string sss = 2 [(nanopb).max_length = 2];
  42. required uint32 num = 3;
  43. required uint32 num2 = 4;
  44. }