From 1a96e9e15b0bcdee121b6d8e67d81bc64823826e Mon Sep 17 00:00:00 2001 From: Saquib Mian Date: Mon, 4 Dec 2023 12:22:03 -0500 Subject: [PATCH] `Commit.id` is not a UUID `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. --- buf/registry/module/v1beta1/branch.proto | 5 +---- buf/registry/module/v1beta1/commit.proto | 5 +---- buf/registry/module/v1beta1/resource.proto | 2 +- buf/registry/module/v1beta1/tag.proto | 5 +---- buf/registry/module/v1beta1/tag_service.proto | 5 +---- buf/registry/module/v1beta1/vcs_commit.proto | 5 +---- 6 files changed, 6 insertions(+), 21 deletions(-) diff --git a/buf/registry/module/v1beta1/branch.proto b/buf/registry/module/v1beta1/branch.proto index 026426d..babe7a5 100644 --- a/buf/registry/module/v1beta1/branch.proto +++ b/buf/registry/module/v1beta1/branch.proto @@ -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]; } diff --git a/buf/registry/module/v1beta1/commit.proto b/buf/registry/module/v1beta1/commit.proto index 628c748..8051f79 100644 --- a/buf/registry/module/v1beta1/commit.proto +++ b/buf/registry/module/v1beta1/commit.proto @@ -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. diff --git a/buf/registry/module/v1beta1/resource.proto b/buf/registry/module/v1beta1/resource.proto index ff4bf8a..8085d23 100644 --- a/buf/registry/module/v1beta1/resource.proto +++ b/buf/registry/module/v1beta1/resource.proto @@ -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; } diff --git a/buf/registry/module/v1beta1/tag.proto b/buf/registry/module/v1beta1/tag.proto index cd5184e..688514c 100644 --- a/buf/registry/module/v1beta1/tag.proto +++ b/buf/registry/module/v1beta1/tag.proto @@ -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. diff --git a/buf/registry/module/v1beta1/tag_service.proto b/buf/registry/module/v1beta1/tag_service.proto index 16c36f1..b507061 100644 --- a/buf/registry/module/v1beta1/tag_service.proto +++ b/buf/registry/module/v1beta1/tag_service.proto @@ -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 [ diff --git a/buf/registry/module/v1beta1/vcs_commit.proto b/buf/registry/module/v1beta1/vcs_commit.proto index 09fafcc..c34dafc 100644 --- a/buf/registry/module/v1beta1/vcs_commit.proto +++ b/buf/registry/module/v1beta1/vcs_commit.proto @@ -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.