Skip to content

Commit

Permalink
Adjust validation for module name length
Browse files Browse the repository at this point in the history
This matches the newly-unified v1alpha1 limits.

required does not seem to be necessary when min_len is present.
  • Loading branch information
jchadwick-buf committed Nov 7, 2023
1 parent f214229 commit ab6f4f7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
6 changes: 4 additions & 2 deletions buf/registry/module/v1beta1/branch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ message BranchRef {
];
// The name of the Module that contains this Branch.
string module = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
// The name of the Branch.
string branch = 3 [
Expand Down
12 changes: 8 additions & 4 deletions buf/registry/module/v1beta1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ message Module {
//
// Unique within a given User or Organization.
string name = 4 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
// The id of the User or Organization that owns the Module.
string owner_id = 5 [
Expand Down Expand Up @@ -108,8 +110,10 @@ message ModuleRef {
];
// The name of the Module.
string module = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
}

Expand Down
6 changes: 4 additions & 2 deletions buf/registry/module/v1beta1/module_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ message CreateModulesRequest {
buf.registry.owner.v1beta1.OwnerRef owner_ref = 1 [(buf.validate.field).required = true];
// The name of the Module.
string name = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
// The module's visibility.
ModuleVisibility visibility = 3 [
Expand Down
6 changes: 4 additions & 2 deletions buf/registry/module/v1beta1/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ message ResourceRef {
];
// The name of the Module the contains or is the resource.
string module = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
oneof child {
// The name of the Branch.
Expand Down
6 changes: 4 additions & 2 deletions buf/registry/module/v1beta1/tag.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ message TagRef {
];
// The name of the Module that contains the Tag, either a User or Organization.
string module = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
// The Tag name.
string tag = 3 [
Expand Down
6 changes: 4 additions & 2 deletions buf/registry/module/v1beta1/vcs_commit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ message VCSCommitRef {
];
// The name of the Module that contains the VCSCommit.
string module = 2 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 255
(buf.validate.field).string = {
min_len: 2,
max_len: 100
}
];
// The hash of the VCSCommit.
string hash = 3 [
Expand Down

0 comments on commit ab6f4f7

Please sign in to comment.