-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert legacy.federation.v1beta1, module.v1beta1 to module.v1beta1, …
…module.v1 (#79) This PR does a bunch of moves and updates: - Moves `buf.registry.module.v1beta1` to `buf.registry.module.v1`. - Moves `buf.registry.legacy.federation.v1beta1` to `buf.registry.module.v1beta1`. - Copies the types not in the old `buf.registry.legacy.federation.v1beta1` into the new `buf.registry.module.v1beta1`. - Moves `buf.registry.owner.v1beta1` to `buf.registry.owner.v1`. The rest of the updates are referenced in terms of their *new* package location, not old package location: - Removes `registry` from `v1beta1.ResourceRef`, instead creating a wrapper `GetGraphRequest.ResourceRef` message that contains a `registry` field. We only need/want `registry` to be added to `ResourceRef` for this specific RPC. - Removes `v1_buf_yaml_file, v1_buf_lock_file` from both `v1beta1` and `v1` `UploadRequests`. - Removes `digest_type` for all `v1` RPC request messages. - Removes `DIGEST_TYPE_B4` in `v1`. - Removes `v1_buf_yaml_file, v1_buf_lock_file` from `v1` `DownloadResponse`. - Removes the `required` market for `v1_buf_yaml_file` from `v1beta1` `DownloadResponse`. The result is a `v1beta1` module API that allows for federation and B4 digests, and a cleaned-up `v1` module API that only has what we need going forward.
- Loading branch information
Showing
27 changed files
with
1,181 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 2023-2024 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"; | ||
|
||
package buf.registry.module.v1; | ||
|
||
import "buf/registry/module/v1/digest.proto"; | ||
import "buf/registry/priv/extension/v1beta1/extension.proto"; | ||
import "buf/validate/validate.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1"; | ||
|
||
// A commit on a specific Module. | ||
// | ||
// Commits are immutable. | ||
// | ||
// Many Commits may be associated with one Digest. | ||
// | ||
// Note that the Digest returned on a Commit depends on the requested DigestType in the | ||
// RPC that returned the Commit. | ||
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 | ||
]; | ||
// The time the Commit was pushed to the BSR. | ||
// | ||
// Commits are immutable, so there is no corresponding update_time. | ||
google.protobuf.Timestamp create_time = 2 [(buf.validate.field).required = true]; | ||
// The id of the User or Organization that owns the Module that the Commit is associated with. | ||
string owner_id = 3 [ | ||
(buf.validate.field).required = true, | ||
(buf.validate.field).string.uuid = true | ||
]; | ||
// The id of the Module that the Commit is associated with. | ||
string module_id = 4 [ | ||
(buf.validate.field).required = true, | ||
(buf.validate.field).string.uuid = true | ||
]; | ||
// The Digest of the Commit's contents. | ||
// | ||
// Note that individual RPCs may request a specific DigestType, and a Digest of | ||
// this DigestType will be returned as part of this Commit. This may affect your | ||
// caching of returned Commit messages if you require different DigestTypes. | ||
Digest digest = 5 [(buf.validate.field).required = true]; | ||
// The id of the User that created this Commit on the BSR. | ||
// | ||
// May be empty if the User is no longer available. | ||
string created_by_user_id = 6 [(buf.validate.field).string.uuid = true]; | ||
// The URL of the source control commit that is associated with the Commit. | ||
// | ||
// 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 [ | ||
(buf.validate.field).string.uri = true, | ||
(buf.validate.field).string.max_len = 255, | ||
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED | ||
]; | ||
} |
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,51 @@ | ||
// Copyright 2023-2024 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"; | ||
|
||
package buf.registry.module.v1; | ||
|
||
import "buf/registry/module/v1/commit.proto"; | ||
import "buf/registry/module/v1/resource.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1"; | ||
|
||
// Operate on Commits. | ||
service CommitService { | ||
// Get Commits. | ||
rpc GetCommits(GetCommitsRequest) returns (GetCommitsResponse) { | ||
option idempotency_level = NO_SIDE_EFFECTS; | ||
} | ||
} | ||
|
||
message GetCommitsRequest { | ||
// References to request a Commit for. | ||
// | ||
// See the documentation on ResourceRef for resource resolution details. | ||
// | ||
// Resolution is as follows: | ||
// - If a Module is referenced, the Commit of the default Label is returned. | ||
// - If a Label is referenced, the Commit of this Label is returned. | ||
// - If a Commit is referenced, this Commit is returned. | ||
repeated ResourceRef resource_refs = 1 [ | ||
(buf.validate.field).repeated.min_items = 1, | ||
(buf.validate.field).repeated.max_items = 250 | ||
]; | ||
} | ||
|
||
message GetCommitsResponse { | ||
// The found Commits in the same order as requested. | ||
repeated Commit commits = 1 [(buf.validate.field).repeated.min_items = 1]; | ||
} |
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,110 @@ | ||
// Copyright 2023-2024 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"; | ||
|
||
package buf.registry.module.v1; | ||
|
||
import "buf/registry/module/v1/commit.proto"; | ||
import "buf/registry/module/v1/file.proto"; | ||
import "buf/registry/module/v1/resource.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1"; | ||
|
||
// Download contents. | ||
service DownloadService { | ||
// Download the contents of multiple Modules, Labels, or Commits. | ||
// | ||
// Content consists of the .proto files, license files, and documentation files. | ||
rpc Download(DownloadRequest) returns (DownloadResponse) { | ||
option idempotency_level = NO_SIDE_EFFECTS; | ||
} | ||
} | ||
|
||
message DownloadRequest { | ||
// A request for content for a single reference. | ||
message Value { | ||
// The reference to get content for. | ||
// | ||
// See the documentation on ResourceRef for resource resolution details. | ||
// | ||
// Once the resource is resolved, the following content is returned: | ||
// - If a Module is referenced, the content of the Commit of the default Label is returned. | ||
// - If a Label is referenced, the content of the Commit of this Label is returned. | ||
// - If a Commit is referenced, the content for this Commit is returned. | ||
ResourceRef resource_ref = 1 [(buf.validate.field).required = true]; | ||
// Specific file types to request. | ||
// | ||
// If not set, all file types are returned. | ||
repeated FileType file_types = 2 [(buf.validate.field).repeated.items.enum.defined_only = true]; | ||
// Specific file paths to retrieve. | ||
// | ||
// May be directories. For example, path "foo/bar" will result in files "foo/bar/baz.proto", | ||
// "foo/bar/LICENSE" being downloaded. | ||
// | ||
// If empty, all file paths for the given reference are retrieved. | ||
// | ||
// If no paths match, an empty Files list will be returned, however the call may still | ||
// be successful if paths_allow_not_exist is set (the dependency list may still be on | ||
// the response). If a directory "foo/bar" is specified but this directory has no files, | ||
// this is considered to be a non-match. | ||
// | ||
// This field also interacts with file_types - if file_types is set, a path only matches | ||
// if it is also of the file type, and if there are no matching paths for the given FileTypes, | ||
// an error is returned unless paths_not_allow_exist is set. | ||
// | ||
// The path must be relative, and cannot contain any "." or ".." components | ||
// The separator "/" must be used. | ||
repeated string paths = 3 [(buf.validate.field).repeated.items = { | ||
string: { | ||
max_len: 4096 | ||
not_contains: "\\" | ||
pattern: "^([^/.][^/]?|[^/][^/.]|[^/]{3,})(/([^/.][^/]?|[^/][^/.]|[^/]{3,}))*$" | ||
} | ||
}]; | ||
// Whether to allow file paths not to exist within the given module. | ||
// | ||
// For example, one may want to retrieve the file paths "buf.md" and "README.md", | ||
// but only expect one to actually exist. | ||
// | ||
// If false, it is an error to specify non-existent file paths. | ||
bool paths_allow_not_exist = 4; | ||
} | ||
// The references to get contents for. | ||
repeated Value values = 1 [ | ||
(buf.validate.field).repeated.min_items = 1, | ||
(buf.validate.field).repeated.max_items = 250 | ||
]; | ||
} | ||
|
||
message DownloadResponse { | ||
// Content for a single Commit. | ||
message Content { | ||
// The Commit associated with the Content. | ||
// | ||
// The Commit associated with this ID will be present in the commits field. | ||
// | ||
// The Commit will use the DigestType specified in the request value. | ||
Commit commit = 1 [(buf.validate.field).required = true]; | ||
// The Files of the content. | ||
// | ||
// This will consist of the .proto files, license files, and documentation files. | ||
// | ||
// If no paths match and paths_allow_not_exist is set, this may be empty. | ||
repeated File files = 2; | ||
} | ||
// The Contents of the references in the same order as requested. | ||
repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1]; | ||
} |
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,59 @@ | ||
// Copyright 2023-2024 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"; | ||
|
||
package buf.registry.module.v1; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1"; | ||
|
||
// A file that can be read or written to from disk. | ||
// | ||
// A File includes a path and associated content. | ||
// Files are purposefully simple, and do not include attributes such as permissions. | ||
message File { | ||
// The path of the File. | ||
// | ||
// The path must be relative, and cannot contain any "." or ".." components. | ||
// The separator "/" must be used. | ||
string path = 1 [ | ||
(buf.validate.field).required = true, | ||
(buf.validate.field).string = { | ||
max_len: 4096, | ||
not_contains: "\\", | ||
pattern: "^([^/.][^/]?|[^/][^/.]|[^/]{3,})(/([^/.][^/]?|[^/][^/.]|[^/]{3,}))*$" | ||
} | ||
]; | ||
// The content of the File. | ||
// | ||
// May be empty. | ||
bytes content = 2; | ||
} | ||
|
||
// A specific file type. | ||
enum FileType { | ||
FILE_TYPE_UNSPECIFIED = 0; | ||
// A .proto file. | ||
FILE_TYPE_PROTO = 1; | ||
// A documentation file. | ||
// | ||
// Documentation files are always named README.md, README.markdown, or buf.md. | ||
FILE_TYPE_DOC = 2; | ||
// A license file. | ||
// | ||
// License files are always named LICENSE. | ||
FILE_TYPE_LICENSE = 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
Oops, something went wrong.