Skip to content

Commit

Permalink
Commit.id is not a UUID
Browse files Browse the repository at this point in the history
`Commit.id` <=> `RepositoryCommit.name`, which is a dashless UUID.

This also implies that `ResourceRef.value.id` is not a UUID.

TODO:
- [ ] Should we drop the UUID validation on all IDs? Ideally our IDs are opaque to users and we are not expressing their shape in the API.
  • Loading branch information
saquibmian committed Dec 4, 2023
1 parent 90664db commit 1a96e9e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
5 changes: 1 addition & 4 deletions buf/registry/module/v1beta1/branch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ message Branch {
// TODO: enum?
bool is_release = 9 [(buf.validate.field).required = true];
// The id of the latest Commit created on the Branch.
string latest_commit_id = 10 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
string latest_commit_id = 10 [(buf.validate.field).required = true];
// The Digest of the latest Commit pushed to the Branch.
buf.registry.storage.v1beta1.Digest latest_commit_digest = 11 [(buf.validate.field).required = true];
}
Expand Down
5 changes: 1 addition & 4 deletions buf/registry/module/v1beta1/commit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ message Commit {
option (buf.registry.priv.extension.v1beta1.message).response_only = true;

// The id of the Commit.
string id = 1 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
string id = 1 [(buf.validate.field).required = true];
// The time the Commit was pushed to the BSR.
//
// Commits are immutable, so there is no corresponding update_time.
Expand Down
2 changes: 1 addition & 1 deletion buf/registry/module/v1beta1/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ message ResourceRef {
oneof value {
option (buf.validate.oneof).required = true;
// The id of the resource.
string id = 1 [(buf.validate.field).string.uuid = true];
string id = 1;
// The fully-qualified name of the resource.
Name name = 2;
}
Expand Down
5 changes: 1 addition & 4 deletions buf/registry/module/v1beta1/tag.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ message Tag {
(buf.validate.field).string.uuid = true
];
// The id of the Commit associated with the Tag.
string commit_id = 7 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
string commit_id = 7 [(buf.validate.field).required = true];
// The Digest of the Commit associated with the Tag.
buf.registry.storage.v1beta1.Digest commit_digest = 8 [(buf.validate.field).required = true];
// The id of the User that last updated this Tag on the BSR.
Expand Down
5 changes: 1 addition & 4 deletions buf/registry/module/v1beta1/tag_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ message CreateTagsRequest {
(buf.validate.field).string.max_len = 250
];
// The id of the Commit associated with the Tag.
string commit_id = 3 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
string commit_id = 3 [(buf.validate.field).required = true];
}
// The Tags to create.
repeated Value values = 1 [
Expand Down
5 changes: 1 addition & 4 deletions buf/registry/module/v1beta1/vcs_commit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ message VCSCommit {
(buf.validate.field).enum.defined_only = true
];
// The id of the Commit associated with the VCSCommit.
string commit_id = 8 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
string commit_id = 8 [(buf.validate.field).required = true];
// The Digest of the Commit associated with the VCSCommit.
buf.registry.storage.v1beta1.Digest commit_digest = 9 [(buf.validate.field).required = true];
// The URL of of the repository on the VCS.
Expand Down

0 comments on commit 1a96e9e

Please sign in to comment.