oneofs.proto 793 B

1234567891011121314151617181920212223242526272829303132333435
  1. syntax = "proto3";
  2. package tests.harness.cases;
  3. option go_package = "github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go;cases";
  4. import "validate/validate.proto";
  5. message TestOneOfMsg {
  6. bool val = 1 [(validate.rules).bool.const = true];
  7. }
  8. message OneOfNone {
  9. oneof o {
  10. string x = 1;
  11. int32 y = 2;
  12. }
  13. }
  14. message OneOf {
  15. oneof o {
  16. string x = 1 [(validate.rules).string.prefix = "foo"];
  17. int32 y = 2 [(validate.rules).int32.gt = 0];
  18. TestOneOfMsg z = 3;
  19. }
  20. }
  21. message OneOfRequired {
  22. oneof o {
  23. option (validate.required) = true;
  24. string x = 1;
  25. int32 y = 2;
  26. int32 name_with_underscores = 3;
  27. int32 under_and_1_number = 4;
  28. }
  29. }