Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move DepRefs and DigestType to top-level #76

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions buf/registry/legacy/federation/v1beta1/upload_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,40 @@ service UploadService {
// See the package documentation for more details. You should likely use buf.registry.module.v1beta1
// and not this package.
message UploadRequest {
// A dependency of Content, either referencing another Content message, or referencing
// a Commit that already exists.
// A dependency of one or more references specified by Contents.
//
// Dependencies between Contents are implicit and do not need to be specified. The BSR will detect
// dependencies between Contents via .proto imports.
message DepRef {
// The Module of the dep.
buf.registry.module.v1beta1.ModuleRef module_ref = 1 [(buf.validate.field).required = true];
unmultimedio marked this conversation as resolved.
Show resolved Hide resolved
// The commit_id of the Commit, if this is referencing a Commit that already exists.
//
// If the ModuleRef refers to a Module that has associated Content, this field should *not*
// be set, and setting it is an error.
string commit_id = 2 [(buf.validate.field).string.uuid = true];
// The registry hostname of the dep.
string registry = 3 [(buf.validate.field).required = true];
// The commit_id of the dependency.
string commit_id = 1 [
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
// The registry hostname of the dependency.
string registry = 2 [(buf.validate.field).required = true];
}
// Content to upload for a given reference.
message Content {
// The Module of the reference.
buf.registry.module.v1beta1.ModuleRef module_ref = 1 [(buf.validate.field).required = true];
// The dependencies of the reference.
//
// This will include all transitive dependencies.
repeated DepRef dep_refs = 2;
// The Files of the Content.
//
// This will consist of the .proto files, license files, and documentation files.
repeated buf.registry.module.v1beta1.File files = 3 [(buf.validate.field).repeated.min_items = 1];
repeated buf.registry.module.v1beta1.File files = 2 [(buf.validate.field).repeated.min_items = 1];
// The original v1beta1 or v1 buf.yaml file that encapsulated this reference, if it existed.
//
// This is used in deprecated digest calculations only. None of the structured
// information within this File will or should convey further information about the reference.
buf.registry.module.v1beta1.File v1_buf_yaml_file = 4;
buf.registry.module.v1beta1.File v1_buf_yaml_file = 3;
// The original v1beta1 or v1 buf.lock file that encapsulated this reference, if it existed.
//
// This is used in deprecated digest calculations only. None of the structured
// information within this File will or should convey further information about the reference.
//
// Importantly, this file is *not* used to determine the dependencies of the reference. To
// specify the dependencies, use the dep_refs fields.
buf.registry.module.v1beta1.File v1_buf_lock_file = 5;
buf.registry.module.v1beta1.File v1_buf_lock_file = 4;
// The labels to associate with the Commit for the Content.
//
// If an id is set, this id must represent a Label that already exists and is
Expand All @@ -89,19 +85,29 @@ message UploadRequest {
//
// If the Labels do not exist, they will be created.
// If the Labels were archived, they will be unarchived.
repeated buf.registry.module.v1beta1.ScopedLabelRef scoped_label_refs = 6;
repeated buf.registry.module.v1beta1.ScopedLabelRef scoped_label_refs = 5;
// The URL of the source control commit to associate with the Commit for this Content.
//
// BSR users can navigate to this link to find source control information that is relevant to this Commit
// (e.g. commit description, PR discussion, authors, approvers, etc.).
string source_control_url = 7 [
string source_control_url = 6 [
(buf.validate.field).string.uri = true,
(buf.validate.field).string.max_len = 255,
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
];
}
// The Contents of all references.
repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1];
// The dependencies of the references specified by Contents.
//
// This will include all transitive dependencies.
//
// Dependencies between Contents are implicit and do not need to be specified. The BSR will detect
// dependencies between Contents via .proto imports.
//
// Commits should be unique by Module, that is no two dep_refs should have the same Module but
// different Commit IDs.
repeated DepRef dep_refs = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an error to include a DepRef that the BSR prunes away? I.e., if a Commit is referenced here that is never imported (even transitively) by any Content.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an error I would say

}

// See the package documentation for more details. You should likely use buf.registry.module.v1beta1
Expand Down
14 changes: 7 additions & 7 deletions buf/registry/module/v1beta1/download_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ message DownloadRequest {
//
// If false, it is an error to specify non-existent file paths.
bool paths_allow_not_exist = 4;
// The DigestType to return for the Commit of this reference.
//
// If this DigestType is not available, an error is returned.
// Note that certain DigestTypes may be deprecated over time.
//
// If not set, the latest DigestType is used, currently B5.
DigestType digest_type = 5 [(buf.validate.field).enum.defined_only = true];
}
// The references to get contents for.
repeated Value values = 1 [
(buf.validate.field).repeated.min_items = 1,
(buf.validate.field).repeated.max_items = 250
];
// The DigestType to return for the Commits of the references.
//
// If this DigestType is not available, an error is returned.
// Note that certain DigestTypes may be deprecated over time.
//
// If not set, the latest DigestType is used, currently B5.
DigestType digest_type = 2 [(buf.validate.field).enum.defined_only = true];
}

message DownloadResponse {
Expand Down
38 changes: 15 additions & 23 deletions buf/registry/module/v1beta1/upload_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,27 @@ service UploadService {
}

message UploadRequest {
// A dependency of Content, either referencing another Content message, or referencing
// a Commit that already exists.
message DepRef {
// The Module of the dep.
ModuleRef module_ref = 1 [(buf.validate.field).required = true];
unmultimedio marked this conversation as resolved.
Show resolved Hide resolved
// The commit_id of the Commit, if this is referencing a Commit that already exists.
//
// If the ModuleRef refers to a Module that has associated Content, this field should be empty,
// and setting a value is an error.
string commit_id = 2 [
(buf.validate.field).string.uuid = true,
(buf.validate.field).ignore_empty = true
];
}
// Content to upload for a given reference.
message Content {
// The Module of the reference.
ModuleRef module_ref = 1 [(buf.validate.field).required = true];
// The dependencies of the reference.
//
// This will include all transitive dependencies.
repeated DepRef dep_refs = 2;
// The Files of the Content.
//
// This will consist of the .proto files, license files, and documentation files.
repeated File files = 3 [(buf.validate.field).repeated.min_items = 1];
repeated File files = 2 [(buf.validate.field).repeated.min_items = 1];
// The original v1beta1 or v1 buf.yaml file that encapsulated this reference, if it existed.
//
// This is used in deprecated digest calculations only. None of the structured
// information within this File will or should convey further information about the reference.
File v1_buf_yaml_file = 4;
File v1_buf_yaml_file = 3;
// The original v1beta1 or v1 buf.lock file that encapsulated this reference, if it existed.
//
// This is used in deprecated digest calculations only. None of the structured
// information within this File will or should convey further information about the reference.
//
// Importantly, this file is *not* used to determine the dependencies of the reference. To
// specify the dependencies, use the dep_refs fields.
File v1_buf_lock_file = 5;
File v1_buf_lock_file = 4;
// The labels to associate with the Commit for the Content.
//
// If an id is set, this id must represent a Label that already exists and is
Expand All @@ -82,19 +64,29 @@ message UploadRequest {
//
// If the Labels do not exist, they will be created.
// If the Labels were archived, they will be unarchived.
repeated ScopedLabelRef scoped_label_refs = 6;
repeated ScopedLabelRef scoped_label_refs = 5;
// The URL of the source control commit to associate with the Commit for this Content.
//
// BSR users can navigate to this link to find source control information that is relevant to this Commit
// (e.g. commit description, PR discussion, authors, approvers, etc.).
string source_control_url = 7 [
string source_control_url = 6 [
(buf.validate.field).string.uri = true,
(buf.validate.field).string.max_len = 255,
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
];
}
// The Contents of all references.
repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1];
// The dependencies of the references specified by Contents.
//
// Dependencies between Contents are implicit and do not need to be specified. The BSR will detect
// dependencies between Contenta via .proto imports.
//
// This will include all transitive dependencies.
//
// Commits should be unique by Module, that is no two dep_commit_ids should have the same Module but
// different Commit IDs.
repeated string dep_commit_ids = 2 [(buf.validate.field).repeated.items.string.uuid = true];
}

message UploadResponse {
Expand Down
Loading