Skip to content

Commit

Permalink
api,is,as: Add validation rules for URL and URI fields
Browse files Browse the repository at this point in the history
  • Loading branch information
htdvisser committed Mar 21, 2019
1 parent 787dd74 commit f81c576
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 234 deletions.
2 changes: 1 addition & 1 deletion api/applicationserver_web.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ message ApplicationWebhook {
google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];

// Base URL to which the message's path is appended.
string base_url = 4 [(gogoproto.customname) = "BaseURL"];
string base_url = 4 [(gogoproto.customname) = "BaseURL", (validate.rules).string.uri = true];
// HTTP headers to use.
map<string,string> headers = 5;
// The format to use for the body.
Expand Down
2 changes: 1 addition & 1 deletion api/oauth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message OAuthAuthorizationCode {
ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true];
repeated Right rights = 3;
string code = 4;
string redirect_uri = 5 [(gogoproto.customname) = "RedirectURI"];
string redirect_uri = 5 [(gogoproto.customname) = "RedirectURI", (validate.rules).string.uri_ref = true];
string state = 6;
google.protobuf.Timestamp created_at = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
google.protobuf.Timestamp expires_at = 8 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
Expand Down
2 changes: 1 addition & 1 deletion api/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ message Picture {
Embedded embedded = 1;

// URLs of the picture for different sizes, if available on a CDN.
map<uint32,string> sizes = 2;
map<uint32,string> sizes = 2 [(validate.rules).map.values.string.uri_ref = true];
}

message Users {
Expand Down
153 changes: 77 additions & 76 deletions pkg/ttnpb/applicationserver_web.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion pkg/ttnpb/applicationserver_web.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f81c576

Please sign in to comment.