-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
371ea23
commit 850813b
Showing
13 changed files
with
344 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
service AccountService { | ||
// DeleteAccount deletes an account. | ||
rpc DeleteAccount(DeleteAccountRequest) returns (DeleteAccountResponse); | ||
} | ||
|
||
message DeleteAccountRequest { | ||
// This validates that field `acknowledgement` must be equal to the bytes for | ||
// "I am aware.". | ||
bytes acknowledgement = 1 [(buf.validate.field).bytes.const = "I am aware."]; | ||
} | ||
|
||
message DeleteAccountResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
message PartingWords { | ||
string content = 1 [(buf.validate.field).string = { | ||
// `in` validates that a string field is one of the values specified. | ||
// In this case, it validates that content is either "Goodbye.' or 'So long.'. | ||
in: [ | ||
"Goodbye.", | ||
"So long." | ||
] | ||
}]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
service TeamService { | ||
rpc UpdateTeamName(UpdateTeamNameRequest) returns (UpdateTeamNameResponse); | ||
} | ||
|
||
message UpdateTeamNameRequest { | ||
string name = 1 [(buf.validate.field).string = { | ||
// `not_in` validates that a string field is not any value from the list | ||
// defined. In this case, it validates that you cannot set a team name | ||
// to "The winners" or "winners". | ||
not_in: [ | ||
"The winners", | ||
"winners" | ||
] | ||
}]; | ||
} | ||
|
||
message UpdateTeamNameResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
// GoodNews is good news in the stock market. | ||
message GoodNews { | ||
string content = 1 [(buf.validate.field).string = { | ||
// `contains` validates that a string field contains this string. | ||
// In this example, it validates that content contains `up`. | ||
contains: "up", | ||
// `not_contains` validates that a string field doesn't contain this string. | ||
// In this example, it validates that content doesn't contain `down`. | ||
not_contains: "down" | ||
}]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
service TermsService { | ||
rpc AcceptTerms(AcceptTermsRequest) returns (AcceptTermsResponse); | ||
} | ||
|
||
message AcceptTermsRequest { | ||
// `const` specifies that a string field must be the same as this string. | ||
// In this case, it validates that content must be "I agree to the terms and conditions.". | ||
string content = 1 [(buf.validate.field).string.const = "I agree to the terms and conditions."]; | ||
} | ||
|
||
message AcceptTermsResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
message HttpHeader { | ||
string name = 1 [(buf.validate.field).string = { | ||
// This validates that name is a valid http header name. | ||
well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME, | ||
}]; | ||
string value = 2 [(buf.validate.field).string = { | ||
// This validates that value is a valid http header value. | ||
well_known_regex: KNOWN_REGEX_HTTP_HEADER_VALUE, | ||
// `strict` applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to | ||
// enable strict header validation. By default this value is true and | ||
// validations are [RFC-compliant](https://tools.ietf.org/html/rfc7230#section-3). | ||
// When `strict` is false, validation only disallows `\r\n\0` characters. | ||
strict: false | ||
}]; | ||
} | ||
|
||
// `well_known_regex` contains some well-known patterns. | ||
// | ||
// | Name | Number | Description | | ||
// |-------------------------------|--------|-------------------------------------------| | ||
// | KNOWN_REGEX_UNSPECIFIED | 0 | | | ||
// | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2) | | ||
// | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.4) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
message User { | ||
string username = 1 [(buf.validate.field).string = { | ||
// `min_len` validates that username must have at least 3 characters. | ||
min_len: 3; | ||
// `max_len` validates that username must have at most 16 characters. | ||
max_len: 16; | ||
}]; | ||
string description = 2 [(buf.validate.field).string = { | ||
// `min_bytes` specifies that a string field must have a least this many bytes. | ||
// In this case, it validates that description must have a least 0 byte, | ||
// which is a no-op. | ||
min_bytes: 0, | ||
// `max_bytes` specifies that a string field must have at most this many bytes. | ||
// In this case, it validates that description can have at most 500 bytes. | ||
max_bytes: 500 | ||
}]; | ||
// `len_bytes` specifies that a string field must have exactly this many bytes. | ||
// In this case, it validates that `id` must have exactly 20 bytes. | ||
string id = 3 [(buf.validate.field).string.len_bytes = 20]; | ||
// `len` specifies that a string field must have exactly this many characters. | ||
// In this case, it validates that `abbreviation` must have exactly 3 characters. | ||
string abbreviation = 4 [(buf.validate.field).string.len = 3]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
message UserProfile { | ||
// `uuid` validates that a string field is a valid uuid. | ||
string user_id = 1 [(buf.validate.field).string.uuid = true]; | ||
// `email` validates that a string field is a valid email. | ||
string email = 2 [(buf.validate.field).string.email = true]; | ||
// phone_number must match the this pattern if it's not empty. | ||
// Note: the `\`s in the regex pattern must be escaped. | ||
string phone_number = 3 [(buf.validate.field) = { | ||
string: { | ||
// `pattern` specifies a regex pattern and validates that the string field | ||
// must match it. | ||
pattern: "^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]\\d{3}[\\s.-]\\d{4}$", | ||
}, | ||
ignore_empty: true, | ||
}]; | ||
// `hostname` specifies that the field value must be a valid hostname as defined | ||
// by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5). | ||
// Note: This constraint doesn't support internationalized domain names (IDNs). | ||
string organization_domain = 4 [(buf.validate.field).string.hostname = true]; | ||
string personal_page = 5 [ | ||
// `uri` validates that a string field must be an absolute uri, as defined by | ||
// [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3). | ||
// | ||
// Or use `uri_ref` to validate that it must be a relative or aboslute URI, as | ||
// defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3). | ||
// (buf.validate.field).string.uri_ref = true, | ||
(buf.validate.field).string.uri = true, | ||
(buf.validate.field).ignore_empty = true | ||
]; | ||
// `ip` specifies that a string field must be a valid ip address, in either v4 or v6. | ||
string last_login_at = 6 [(buf.validate.field).string.ip = true]; | ||
// To validate against a specific version, use `ipv4` or `ipv6` instead. | ||
// | ||
// string last_login = 5 [(buf.validate.field).string.ipv4 = true]; | ||
// string last_login = 5 [(buf.validate.field).string.ipv6 = true]; | ||
} | ||
|
||
message HyperLink { | ||
string text = 1; | ||
// `address` specifies that the field value must be either a valid hostname | ||
// as defined by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5) | ||
// (which doesn't support internationalized domain names or IDNs) or a valid | ||
// IP (v4 or v6). | ||
string address = 2 [(buf.validate.field).string.address = true]; | ||
} |
Oops, something went wrong.