Skip to content

Instantly share code, notes, and snippets.

@junr03
Created July 26, 2018 05:46
Show Gist options
  • Save junr03/11c938fc405b0bdbe94aec5e242ce3a5 to your computer and use it in GitHub Desktop.
Save junr03/11c938fc405b0bdbe94aec5e242ce3a5 to your computer and use it in GitHub Desktop.
syntax = "proto3";

import "validate/validate.proto";

message Person {
  uint64 id    = 1 [(validate.rules).uint64.gt = 999];

  string email = 2 [(validate.rules).string.email = true];

  Location home = 4 [(validate.rules).message.required = true];

  message Location {
    double lat = 1 [(validate.rules).double = { gte: -90,  lte: 90 }];
    double lng = 2 [(validate.rules).double = { gte: -180, lte: 180 }];
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment