diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7f5d1daca..bd071ebdf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -49,11 +49,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: bufbuild/buf-setup-action@eb60cd0de4f14f1f57cf346916b8cd69a9e7ed0b # v1.26.1 + - uses: bufbuild/buf-action@5150a1eef5c10b6a5cf8a69fc872f24a09473195 # v1.1.1 with: - buf_user: ${{ secrets.buf_user }} - buf_api_token: ${{ secrets.buf_api_token }} - - uses: bufbuild/buf-lint-action@bd48f53224baaaf0fc55de9a913e7680ca6dbea4 # v1.0.3 + version: 1.49.0 + token: ${{ secrets.buf_api_token }} + breaking: false + pr_comment: false lint-dagger-module: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 62a440882..c1f99786f 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ API_PROTO_FILES=$(shell find api -name *.proto) # generate api proto api: cd ./pkg/attestation/crafter/api && buf generate - make -C ./app/controlplane api - make -C ./app/artifact-cas api + cd ./app/controlplane && make api + cd ./app/artifact-cas && make api .PHONY: config # generate config proto diff --git a/app/artifact-cas/api/buf.lock b/app/artifact-cas/api/buf.lock index f1d8f9aa8..4a5f100ea 100644 --- a/app/artifact-cas/api/buf.lock +++ b/app/artifact-cas/api/buf.lock @@ -5,7 +5,14 @@ deps: owner: bufbuild repository: protovalidate commit: b983156c5e994cc9892e0ce3e64e17e0 + digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2 - remote: buf.build owner: googleapis repository: googleapis - commit: 7a6bc1e3207144b38e9066861e1de0ff + commit: 4ed3bc159a8b4ac68fe253218760d035 + digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13 + - remote: buf.build + owner: grpc-ecosystem + repository: grpc-gateway + commit: 4c5ba75caaf84e928b7137ae5c18c26a + digest: shake256:e174ad9408f3e608f6157907153ffec8d310783ee354f821f57178ffbeeb8faa6bb70b41b61099c1783c82fe16210ebd1279bc9c9ee6da5cffba9f0e675b8b99 diff --git a/app/artifact-cas/api/buf.yaml b/app/artifact-cas/api/buf.yaml index 65919fd53..fe7089ac2 100644 --- a/app/artifact-cas/api/buf.yaml +++ b/app/artifact-cas/api/buf.yaml @@ -3,8 +3,8 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 lint: use: - DEFAULT diff --git a/app/artifact-cas/internal/conf/buf.lock b/app/artifact-cas/internal/conf/buf.lock index f1d8f9aa8..ead3743a2 100644 --- a/app/artifact-cas/internal/conf/buf.lock +++ b/app/artifact-cas/internal/conf/buf.lock @@ -5,6 +5,7 @@ deps: owner: bufbuild repository: protovalidate commit: b983156c5e994cc9892e0ce3e64e17e0 + digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2 - remote: buf.build owner: googleapis repository: googleapis diff --git a/app/artifact-cas/internal/conf/buf.yaml b/app/artifact-cas/internal/conf/buf.yaml index 097510831..877fd716d 100644 --- a/app/artifact-cas/internal/conf/buf.yaml +++ b/app/artifact-cas/internal/conf/buf.yaml @@ -3,8 +3,8 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 lint: use: - DEFAULT diff --git a/app/controlplane/Makefile b/app/controlplane/Makefile index bb2326048..e1d62136d 100644 --- a/app/controlplane/Makefile +++ b/app/controlplane/Makefile @@ -9,7 +9,11 @@ config: check-buf-tool # generate api proto bindings api: check-buf-tool cd ./plugins/sdk/v1/plugin/api && buf generate - cd ./api && buf generate + cd ./api && buf generate && \ + buf generate \ + --path ./controlplane/v1/referrer.proto \ + --path ./controlplane/v1/openapi_metadata.proto && \ + ../scripts/modify-openapi-schema.sh ${PWD}/api/gen temp-openapi/apidocs.swagger.json openapi/openapi/openapi.yaml openapi/openapi-extra.yaml .PHONY: build # build diff --git a/app/controlplane/api/buf.gen.yaml b/app/controlplane/api/buf.gen.yaml index 73c941f30..e00f01394 100644 --- a/app/controlplane/api/buf.gen.yaml +++ b/app/controlplane/api/buf.gen.yaml @@ -21,3 +21,8 @@ plugins: - useOptionals=messages # use optional TypeScript properties instead of undefined - plugin: buf.build/bufbuild/protoschema-jsonschema:v0.2.0 out: ./gen/jsonschema + - plugin: buf.build/grpc-ecosystem/openapiv2:v2.26.3 + out: gen/temp-openapi + opt: + - allow_merge=true + - json_names_for_fields=false diff --git a/app/controlplane/api/buf.lock b/app/controlplane/api/buf.lock index 75e04d97d..235dcb4aa 100644 --- a/app/controlplane/api/buf.lock +++ b/app/controlplane/api/buf.lock @@ -5,11 +5,19 @@ deps: owner: bufbuild repository: protovalidate commit: b983156c5e994cc9892e0ce3e64e17e0 + digest: shake256:436ce453801917c11bc7b21d66bcfae87da2aceb804a041487be1e51dc9fbc219e61ea6a552db7a7aa6d63bb5efd0f3ed5fe3d4c42d4f750d0eb35f14144e3b6 - remote: buf.build owner: googleapis repository: googleapis commit: 4ed3bc159a8b4ac68fe253218760d035 + digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13 + - remote: buf.build + owner: grpc-ecosystem + repository: grpc-gateway + commit: 4c5ba75caaf84e928b7137ae5c18c26a + digest: shake256:e174ad9408f3e608f6157907153ffec8d310783ee354f821f57178ffbeeb8faa6bb70b41b61099c1783c82fe16210ebd1279bc9c9ee6da5cffba9f0e675b8b99 - remote: buf.build owner: kratos-go repository: kratos commit: e1d52e944e3845c6862a566db322432d + digest: shake256:f7a0c398ccbb951aa222af7f1d822bfc5a9978fbaef040679e7d85c98568198c88e0727f6d2837a3e0fbb853d3ece0f9c3c8e92a90709e05a3bf69144137b48e diff --git a/app/controlplane/api/buf.yaml b/app/controlplane/api/buf.yaml index 4cfbd1df6..8e996f6d0 100644 --- a/app/controlplane/api/buf.yaml +++ b/app/controlplane/api/buf.yaml @@ -3,9 +3,10 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate - - buf.build/kratos-go/kratos + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 + - buf.build/kratos-go/kratos:e1d52e944e3845c6862a566db322432d + - buf.build/grpc-ecosystem/grpc-gateway:v2.26.3 lint: use: - DEFAULT diff --git a/app/controlplane/api/controlplane/v1/api_token.proto b/app/controlplane/api/controlplane/v1/api_token.proto index d37e317a1..71a52f708 100644 --- a/app/controlplane/api/controlplane/v1/api_token.proto +++ b/app/controlplane/api/controlplane/v1/api_token.proto @@ -49,10 +49,10 @@ message APITokenServiceRevokeRequest { string name = 1 [(buf.validate.field) = { // NOTE: validations can not be shared yet https://github.com/bufbuild/protovalidate/issues/51 cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; } diff --git a/app/controlplane/api/controlplane/v1/auth.proto b/app/controlplane/api/controlplane/v1/auth.proto index 99eadf51b..b5387778d 100644 --- a/app/controlplane/api/controlplane/v1/auth.proto +++ b/app/controlplane/api/controlplane/v1/auth.proto @@ -16,15 +16,15 @@ syntax = "proto3"; package controlplane.v1; + option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; service AuthService { - rpc DeleteAccount (AuthServiceDeleteAccountRequest) returns (AuthServiceDeleteAccountResponse); + rpc DeleteAccount(AuthServiceDeleteAccountRequest) returns (AuthServiceDeleteAccountResponse); } // AuthServiceDeleteAccountResponse is the response for the DeleteAccount method. message AuthServiceDeleteAccountRequest {} // AuthServiceDeleteAccountResponse is the response for the DeleteAccount method. -message AuthServiceDeleteAccountResponse { -} +message AuthServiceDeleteAccountResponse {} diff --git a/app/controlplane/api/controlplane/v1/cas_backends.proto b/app/controlplane/api/controlplane/v1/cas_backends.proto index d83e9b53d..0fb3c7887 100644 --- a/app/controlplane/api/controlplane/v1/cas_backends.proto +++ b/app/controlplane/api/controlplane/v1/cas_backends.proto @@ -63,10 +63,10 @@ message CASBackendServiceUpdateRequest { string name = 1 [(buf.validate.field) = { // NOTE: validations can not be shared yet https://github.com/bufbuild/protovalidate/issues/51 cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; // Description string description = 2; @@ -84,10 +84,10 @@ message CASBackendServiceDeleteRequest { string name = 1 [(buf.validate.field) = { // NOTE: validations can not be shared yet https://github.com/bufbuild/protovalidate/issues/51 cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; } diff --git a/app/controlplane/api/controlplane/v1/cas_redirect.proto b/app/controlplane/api/controlplane/v1/cas_redirect.proto index 90e373b19..de311d970 100644 --- a/app/controlplane/api/controlplane/v1/cas_redirect.proto +++ b/app/controlplane/api/controlplane/v1/cas_redirect.proto @@ -17,13 +17,13 @@ syntax = "proto3"; package controlplane.v1; -option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; - import "buf/validate/validate.proto"; +option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; + service CASRedirectService { - // Retrieve the URL to download an artifact in CAS - rpc GetDownloadURL (GetDownloadURLRequest) returns (GetDownloadURLResponse); + // Retrieve the URL to download an artifact in CAS + rpc GetDownloadURL(GetDownloadURLRequest) returns (GetDownloadURLResponse); } message GetDownloadURLRequest { @@ -32,7 +32,7 @@ message GetDownloadURLRequest { message GetDownloadURLResponse { Result result = 1; - + message Result { string url = 2; } diff --git a/app/controlplane/api/controlplane/v1/openapi_metadata.pb.go b/app/controlplane/api/controlplane/v1/openapi_metadata.pb.go new file mode 100644 index 000000000..3252d2267 --- /dev/null +++ b/app/controlplane/api/controlplane/v1/openapi_metadata.pb.go @@ -0,0 +1,92 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: controlplane/v1/openapi_metadata.proto + +package v1 + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_controlplane_v1_openapi_metadata_proto protoreflect.FileDescriptor + +var file_controlplane_v1_openapi_metadata_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x95, 0x03, 0x92, 0x41, 0xc5, 0x02, + 0x12, 0x81, 0x01, 0x0a, 0x1a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x20, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x20, 0x41, 0x50, 0x49, 0x1a, + 0x1b, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0x41, 0x0a, 0x11, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x20, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x64, 0x65, 0x76, 0x1a, 0x15, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x40, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x64, 0x65, 0x76, 0x32, + 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x10, 0x63, 0x70, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x64, 0x65, 0x76, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5a, 0x45, 0x0a, 0x43, 0x0a, + 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x34, 0x08, 0x02, + 0x12, 0x1f, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x20, 0x66, + 0x6f, 0x72, 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x20, 0x02, 0x62, 0x11, 0x0a, 0x0f, 0x0a, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x00, 0x72, 0x3e, 0x0a, 0x20, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, + 0x6f, 0x70, 0x20, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x20, 0x44, 0x6f, 0x63, 0x75, + 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x68, 0x74, 0x74, 0x70, 0x73, + 0x3a, 0x2f, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x64, 0x65, 0x76, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_controlplane_v1_openapi_metadata_proto_goTypes = []interface{}{} +var file_controlplane_v1_openapi_metadata_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_controlplane_v1_openapi_metadata_proto_init() } +func file_controlplane_v1_openapi_metadata_proto_init() { + if File_controlplane_v1_openapi_metadata_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controlplane_v1_openapi_metadata_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_controlplane_v1_openapi_metadata_proto_goTypes, + DependencyIndexes: file_controlplane_v1_openapi_metadata_proto_depIdxs, + }.Build() + File_controlplane_v1_openapi_metadata_proto = out.File + file_controlplane_v1_openapi_metadata_proto_rawDesc = nil + file_controlplane_v1_openapi_metadata_proto_goTypes = nil + file_controlplane_v1_openapi_metadata_proto_depIdxs = nil +} diff --git a/app/controlplane/api/controlplane/v1/openapi_metadata.proto b/app/controlplane/api/controlplane/v1/openapi_metadata.proto new file mode 100644 index 000000000..932780c93 --- /dev/null +++ b/app/controlplane/api/controlplane/v1/openapi_metadata.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package controlplane.v1; + +import "protoc-gen-openapiv2/options/annotations.proto"; + +option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Chainloop Controlplane API" + version: "1.0" + contact: { + name: "Chainloop Support" + url: "https://chainloop.dev" + email: "support@chainloop.dev" + } + terms_of_service: "https://chainloop.dev/terms" + } + schemes: [HTTPS] + consumes: ["application/json"] + host: "cp.chainloop.dev" + security_definitions: { + security: { + key: "bearerToken" + value: { + name: "Authorization" + description: "Bearer token for authentication" + type: TYPE_API_KEY + in: IN_HEADER + } + } + } + security: [ + { + security_requirement: {key: "bearerToken"} + } + ] + external_docs: { + description: "Chainloop Official Documentation" + url: "https://docs.chainloop.dev" + } +}; diff --git a/app/controlplane/api/controlplane/v1/org_invitation.pb.go b/app/controlplane/api/controlplane/v1/org_invitation.pb.go index fa3d5af79..5ec31366f 100644 --- a/app/controlplane/api/controlplane/v1/org_invitation.pb.go +++ b/app/controlplane/api/controlplane/v1/org_invitation.pb.go @@ -422,13 +422,13 @@ var file_controlplane_v1_org_invitation_proto_rawDesc = []byte{ 0x0a, 0x24, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x5f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, - 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, + 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, + 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, 0x21, 0x4f, 0x72, 0x67, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, diff --git a/app/controlplane/api/controlplane/v1/org_invitation.proto b/app/controlplane/api/controlplane/v1/org_invitation.proto index 8e7818ae5..b7445d6c6 100644 --- a/app/controlplane/api/controlplane/v1/org_invitation.proto +++ b/app/controlplane/api/controlplane/v1/org_invitation.proto @@ -17,9 +17,9 @@ syntax = "proto3"; package controlplane.v1; +import "buf/validate/validate.proto"; import "controlplane/v1/response_messages.proto"; import "google/protobuf/timestamp.proto"; -import "buf/validate/validate.proto"; option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; diff --git a/app/controlplane/api/controlplane/v1/org_metrics.pb.go b/app/controlplane/api/controlplane/v1/org_metrics.pb.go index 90a78563b..90d31a110 100644 --- a/app/controlplane/api/controlplane/v1/org_metrics.pb.go +++ b/app/controlplane/api/controlplane/v1/org_metrics.pb.go @@ -682,11 +682,11 @@ var file_controlplane_v1_org_metrics_proto_rawDesc = []byte{ 0x0a, 0x21, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x62, - 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x77, 0x6f, 0x72, 0x6b, + 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x61, 0x66, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x01, 0x0a, 0x15, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, diff --git a/app/controlplane/api/controlplane/v1/org_metrics.proto b/app/controlplane/api/controlplane/v1/org_metrics.proto index ac0dfb756..cec4cc2b5 100644 --- a/app/controlplane/api/controlplane/v1/org_metrics.proto +++ b/app/controlplane/api/controlplane/v1/org_metrics.proto @@ -17,8 +17,8 @@ syntax = "proto3"; package controlplane.v1; -import "controlplane/v1/response_messages.proto"; import "buf/validate/validate.proto"; +import "controlplane/v1/response_messages.proto"; import "workflowcontract/v1/crafting_schema.proto"; option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; @@ -77,7 +77,7 @@ message MetricsRunnerCount { message TopWorkflowsByRunsCountRequest { // top x number of runs to return int32 num_workflows = 1 [(buf.validate.field).int32 = { - gte: 1, + gte: 1 lte: 20 }]; MetricsTimeWindow time_window = 2 [(buf.validate.field).enum = { diff --git a/app/controlplane/api/controlplane/v1/pagination.proto b/app/controlplane/api/controlplane/v1/pagination.proto index 227dfe679..1627227e3 100644 --- a/app/controlplane/api/controlplane/v1/pagination.proto +++ b/app/controlplane/api/controlplane/v1/pagination.proto @@ -30,7 +30,7 @@ message CursorPaginationRequest { // Limit pagination to 100 int32 limit = 3 [ (buf.validate.field).int32 = { - gte: 1, + gte: 1 lte: 100 }, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED @@ -42,7 +42,10 @@ message OffsetPaginationRequest { // The (zero-based) offset of the first item returned in the collection. int32 page = 1 [(buf.validate.field).int32.gte = 1]; // The maximum number of entries to return. If the value exceeds the maximum, then the maximum value will be used. - int32 page_size = 2 [(buf.validate.field).int32.gt = 0, (buf.validate.field).int32.lte = 100]; + int32 page_size = 2 [ + (buf.validate.field).int32.gt = 0, + (buf.validate.field).int32.lte = 100 + ]; } // OffsetPaginationResponse is used to return the pagination information diff --git a/app/controlplane/api/controlplane/v1/referrer.pb.go b/app/controlplane/api/controlplane/v1/referrer.pb.go index d94d595ec..94155c062 100644 --- a/app/controlplane/api/controlplane/v1/referrer.pb.go +++ b/app/controlplane/api/controlplane/v1/referrer.pb.go @@ -23,6 +23,7 @@ package v1 import ( _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -38,13 +39,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// ReferrerServiceDiscoverPrivateRequest is the request for the DiscoverPrivate method type ReferrerServiceDiscoverPrivateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Digest is the unique identifier of the referrer to discover Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` - // Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + // Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... // Used to filter and resolve ambiguities Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` } @@ -95,13 +98,15 @@ func (x *ReferrerServiceDiscoverPrivateRequest) GetKind() string { return "" } +// DiscoverPublicSharedRequest is the request for the DiscoverPublicShared method type DiscoverPublicSharedRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Digest is the unique identifier of the referrer to discover Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` - // Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + // Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... // Used to filter and resolve ambiguities Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` } @@ -152,11 +157,13 @@ func (x *DiscoverPublicSharedRequest) GetKind() string { return "" } +// DiscoverPublicSharedResponse is the response for the DiscoverPublicShared method type DiscoverPublicSharedResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Result is the discovered referrer item Result *ReferrerItem `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` } @@ -199,11 +206,13 @@ func (x *DiscoverPublicSharedResponse) GetResult() *ReferrerItem { return nil } +// ReferrerServiceDiscoverPrivateResponse is the response for the DiscoverPrivate method type ReferrerServiceDiscoverPrivateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Result is the discovered referrer item Result *ReferrerItem `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` } @@ -246,6 +255,7 @@ func (x *ReferrerServiceDiscoverPrivateResponse) GetResult() *ReferrerItem { return nil } +// ReferrerItem represents a referrer object in the system type ReferrerItem struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -255,14 +265,18 @@ type ReferrerItem struct { Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` // Kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` - // Whether the referrer is downloadable or not from CAS + // Downloadable indicates whether the referrer is downloadable or not from CAS Downloadable bool `protobuf:"varint,3,opt,name=downloadable,proto3" json:"downloadable,omitempty"` - // Whether the referrer is public since it belongs to a public workflow - Public bool `protobuf:"varint,6,opt,name=public,proto3" json:"public,omitempty"` - References []*ReferrerItem `protobuf:"bytes,4,rep,name=references,proto3" json:"references,omitempty"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Annotations map[string]string `protobuf:"bytes,8,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Public indicates whether the referrer is public since it belongs to a public workflow + Public bool `protobuf:"varint,6,opt,name=public,proto3" json:"public,omitempty"` + // References contains the list of related referrer items + References []*ReferrerItem `protobuf:"bytes,4,rep,name=references,proto3" json:"references,omitempty"` + // CreatedAt is the timestamp when the referrer was created + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + // Metadata contains additional descriptive information about the referrer + Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Annotations are key-value pairs associated with the referrer + Annotations map[string]string `protobuf:"bytes,8,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *ReferrerItem) Reset() { @@ -364,89 +378,139 @@ var file_controlplane_v1_referrer_proto_rawDesc = []byte{ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, - 0x25, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, - 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x52, 0x0a, 0x1b, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x64, 0x69, - 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6b, - 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, - 0x55, 0x0a, 0x1c, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, + 0x0a, 0x25, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x3a, 0x54, 0x92, 0x41, + 0x51, 0x0a, 0x4f, 0x2a, 0x25, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x26, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x20, + 0x61, 0x20, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, + 0x65, 0x72, 0x22, 0xa4, 0x01, 0x0a, 0x1b, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x3a, 0x50, 0x92, 0x41, 0x4d, 0x0a, 0x4b, 0x2a, 0x1b, + 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x2c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x20, 0x61, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x44, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, + 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x3a, 0x51, 0x92, 0x41, 0x4e, 0x0a, 0x4c, 0x2a, 0x1c, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x2c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x22, 0xb7, 0x01, 0x0a, 0x26, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x5f, 0x0a, 0x26, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, - 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x35, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x88, 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, - 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, - 0x6c, 0x6f, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x12, 0x3d, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, - 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, - 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, - 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x47, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x50, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x32, 0xcb, 0x02, 0x0a, 0x0f, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9e, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x36, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x7b, - 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x7d, 0x12, 0x96, 0x01, 0x0a, 0x14, 0x44, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, - 0x12, 0x2c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x7b, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x7d, - 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3a, 0x56, 0x92, 0x41, 0x53, 0x0a, 0x51, 0x2a, 0x26, 0x52, + 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x27, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0xcc, + 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, + 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x64, + 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x3d, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x12, 0x47, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, + 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, + 0x65, 0x6d, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x50, 0x0a, 0x0b, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x41, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x42, 0x92, 0x41, 0x3f, 0x0a, 0x3d, + 0x2a, 0x0c, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x32, 0x2d, + 0x49, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, + 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x32, 0xa9, 0x05, + 0x0a, 0x0f, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0xa9, 0x02, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa4, 0x01, 0x92, 0x41, 0x86, 0x01, 0x12, 0x19, 0x44, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x1a, 0x57, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x20, 0x69, + 0x74, 0x65, 0x6d, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, + 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x2d, 0x69, 0x6e, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, + 0x73, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x64, 0x69, 0x73, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x7b, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x7d, 0x12, 0x96, 0x02, + 0x0a, 0x14, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x12, 0x2c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, + 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xa0, 0x01, 0x92, 0x41, 0x7c, 0x12, 0x1f, 0x44, 0x69, 0x73, 0x63, 0x6f, + 0x76, 0x65, 0x72, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x1a, 0x47, 0x52, 0x65, 0x74, 0x75, + 0x72, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, + 0x20, 0x69, 0x74, 0x65, 0x6d, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, + 0x6e, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x7b, 0x64, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x7d, 0x1a, 0x51, 0x92, 0x41, 0x4e, 0x0a, 0x0f, 0x52, 0x65, 0x66, + 0x65, 0x72, 0x72, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x66, + 0x6f, 0x72, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, + 0x62, 0x79, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, + 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/app/controlplane/api/controlplane/v1/referrer.proto b/app/controlplane/api/controlplane/v1/referrer.proto index 5c0bf90fa..c93bbe6f4 100644 --- a/app/controlplane/api/controlplane/v1/referrer.proto +++ b/app/controlplane/api/controlplane/v1/referrer.proto @@ -20,6 +20,7 @@ package controlplane.v1; import "buf/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; @@ -27,47 +28,109 @@ service ReferrerService { // DiscoverPrivate returns the referrer item for a given digest in the organizations of the logged-in user rpc DiscoverPrivate(ReferrerServiceDiscoverPrivateRequest) returns (ReferrerServiceDiscoverPrivateResponse) { option (google.api.http) = {get: "/discover/{digest}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Discover private referrer" + description: "Returns the referrer item for a given digest in the organizations of the logged-in user" + produces: ["application/json"] + }; } // DiscoverPublicShared returns the referrer item for a given digest in the public shared index rpc DiscoverPublicShared(DiscoverPublicSharedRequest) returns (DiscoverPublicSharedResponse) { option (google.api.http) = {get: "/discover/shared/{digest}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Discover public shared referrer" + description: "Returns the referrer item for a given digest in the public shared index" + produces: ["application/json"] + }; } + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { + name: "ReferrerService" + description: "Referrer service for discovering referred content by digest" + }; } +// ReferrerServiceDiscoverPrivateRequest is the request for the DiscoverPrivate method message ReferrerServiceDiscoverPrivateRequest { + // Digest is the unique identifier of the referrer to discover string digest = 1 [(buf.validate.field).string = {min_len: 1}]; - // Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + // Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... // Used to filter and resolve ambiguities string kind = 2; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "ReferrerServiceDiscoverPrivateRequest" + description: "Request to discover a private referrer" + } + }; } +// DiscoverPublicSharedRequest is the request for the DiscoverPublicShared method message DiscoverPublicSharedRequest { + // Digest is the unique identifier of the referrer to discover string digest = 1 [(buf.validate.field).string = {min_len: 1}]; - // Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + // Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... // Used to filter and resolve ambiguities string kind = 2; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "DiscoverPublicSharedRequest" + description: "Request to discover a public shared referrer" + } + }; } +// DiscoverPublicSharedResponse is the response for the DiscoverPublicShared method message DiscoverPublicSharedResponse { + // Result is the discovered referrer item ReferrerItem result = 1; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "DiscoverPublicSharedResponse" + description: "Response for the DiscoverPublicShared method" + } + }; } +// ReferrerServiceDiscoverPrivateResponse is the response for the DiscoverPrivate method message ReferrerServiceDiscoverPrivateResponse { + // Result is the discovered referrer item ReferrerItem result = 1; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "ReferrerServiceDiscoverPrivateResponse" + description: "Response for the DiscoverPrivate method" + } + }; } +// ReferrerItem represents a referrer object in the system message ReferrerItem { // Digest of the referrer, i.e sha256:deadbeef or sha1:beefdead string digest = 1; // Kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... string kind = 2; - // Whether the referrer is downloadable or not from CAS + // Downloadable indicates whether the referrer is downloadable or not from CAS bool downloadable = 3; - // Whether the referrer is public since it belongs to a public workflow + // Public indicates whether the referrer is public since it belongs to a public workflow bool public = 6; + // References contains the list of related referrer items repeated ReferrerItem references = 4; + // CreatedAt is the timestamp when the referrer was created google.protobuf.Timestamp created_at = 5; - + // Metadata contains additional descriptive information about the referrer map metadata = 7; + // Annotations are key-value pairs associated with the referrer map annotations = 8; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "ReferrerItem" + description: "It represents a referrer object in the system" + } + }; } diff --git a/app/controlplane/api/controlplane/v1/robot_accounts.proto b/app/controlplane/api/controlplane/v1/robot_accounts.proto index b2e32ab49..464141dce 100644 --- a/app/controlplane/api/controlplane/v1/robot_accounts.proto +++ b/app/controlplane/api/controlplane/v1/robot_accounts.proto @@ -17,19 +17,19 @@ syntax = "proto3"; package controlplane.v1; -option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; - import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; + service RobotAccountService { - rpc Create (RobotAccountServiceCreateRequest) returns (RobotAccountServiceCreateResponse); - rpc List (RobotAccountServiceListRequest) returns (RobotAccountServiceListResponse); - rpc Revoke (RobotAccountServiceRevokeRequest) returns (RobotAccountServiceRevokeResponse); + rpc Create(RobotAccountServiceCreateRequest) returns (RobotAccountServiceCreateResponse); + rpc List(RobotAccountServiceListRequest) returns (RobotAccountServiceListResponse); + rpc Revoke(RobotAccountServiceRevokeRequest) returns (RobotAccountServiceRevokeResponse); } message RobotAccountServiceCreateRequest { - string name = 1; + string name = 1; string workflow_id = 2 [(buf.validate.field).string.uuid = true]; } @@ -37,13 +37,13 @@ message RobotAccountServiceCreateResponse { RobotAccountFull result = 1; message RobotAccountFull { - string id = 1; - string name = 2; - string workflow_id = 3; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp revoked_at = 5; - // The key is returned only during creation - string key = 6; + string id = 1; + string name = 2; + string workflow_id = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp revoked_at = 5; + // The key is returned only during creation + string key = 6; } } @@ -68,4 +68,4 @@ message RobotAccountServiceListResponse { google.protobuf.Timestamp created_at = 4; google.protobuf.Timestamp revoked_at = 5; } -} \ No newline at end of file +} diff --git a/app/controlplane/api/controlplane/v1/signing.proto b/app/controlplane/api/controlplane/v1/signing.proto index 3ad7d2d4f..e992fad5e 100644 --- a/app/controlplane/api/controlplane/v1/signing.proto +++ b/app/controlplane/api/controlplane/v1/signing.proto @@ -13,19 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. - syntax = "proto3"; package controlplane.v1; -option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; - import "buf/validate/validate.proto"; +option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; + service SigningService { // GenerateSigningCert takes a certificate request and generates a new certificate for attestation signing - rpc GenerateSigningCert (GenerateSigningCertRequest) returns (GenerateSigningCertResponse); - rpc GetTrustedRoot (GetTrustedRootRequest) returns (GetTrustedRootResponse); + rpc GenerateSigningCert(GenerateSigningCertRequest) returns (GenerateSigningCertResponse); + rpc GetTrustedRoot(GetTrustedRootRequest) returns (GetTrustedRootResponse); } message GenerateSigningCertRequest { diff --git a/app/controlplane/api/controlplane/v1/user.pb.go b/app/controlplane/api/controlplane/v1/user.pb.go index 4590f9c2f..28b4a42ed 100644 --- a/app/controlplane/api/controlplane/v1/user.pb.go +++ b/app/controlplane/api/controlplane/v1/user.pb.go @@ -305,11 +305,11 @@ var File_controlplane_v1_user_proto protoreflect.FileDescriptor var file_controlplane_v1_user_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x27, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, + 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x23, 0x0a, 0x21, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x60, 0x0a, 0x22, 0x55, 0x73, 0x65, 0x72, diff --git a/app/controlplane/api/controlplane/v1/user.proto b/app/controlplane/api/controlplane/v1/user.proto index 872a58143..881bda578 100644 --- a/app/controlplane/api/controlplane/v1/user.proto +++ b/app/controlplane/api/controlplane/v1/user.proto @@ -17,8 +17,8 @@ syntax = "proto3"; package controlplane.v1; -import "controlplane/v1/response_messages.proto"; import "buf/validate/validate.proto"; +import "controlplane/v1/response_messages.proto"; option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; diff --git a/app/controlplane/api/controlplane/v1/workflow.pb.go b/app/controlplane/api/controlplane/v1/workflow.pb.go index 62e232c95..76d8465c9 100644 --- a/app/controlplane/api/controlplane/v1/workflow.pb.go +++ b/app/controlplane/api/controlplane/v1/workflow.pb.go @@ -748,16 +748,16 @@ var file_controlplane_v1_workflow_proto_rawDesc = []byte{ 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x6a, 0x73, 0x6f, 0x6e, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x61, 0x66, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x6a, 0x73, 0x6f, 0x6e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x2f, 0x76, 0x31, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x03, 0x0a, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x97, 0x01, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, @@ -1046,8 +1046,8 @@ func file_controlplane_v1_workflow_proto_init() { if File_controlplane_v1_workflow_proto != nil { return } - file_controlplane_v1_response_messages_proto_init() file_controlplane_v1_pagination_proto_init() + file_controlplane_v1_response_messages_proto_init() if !protoimpl.UnsafeEnabled { file_controlplane_v1_workflow_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowServiceCreateRequest); i { diff --git a/app/controlplane/api/controlplane/v1/workflow.proto b/app/controlplane/api/controlplane/v1/workflow.proto index ff315e85b..cf649a572 100644 --- a/app/controlplane/api/controlplane/v1/workflow.proto +++ b/app/controlplane/api/controlplane/v1/workflow.proto @@ -18,10 +18,10 @@ syntax = "proto3"; package controlplane.v1; import "buf/validate/validate.proto"; -import "controlplane/v1/response_messages.proto"; import "controlplane/v1/pagination.proto"; -import "workflowcontract/v1/crafting_schema.proto"; +import "controlplane/v1/response_messages.proto"; import "jsonfilter/v1/jsonfilter.proto"; +import "workflowcontract/v1/crafting_schema.proto"; option go_package = "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1;v1"; @@ -116,17 +116,26 @@ message WorkflowServiceListRequest { // If the workflow is public optional bool workflow_public = 5; // The type of runner that ran the workflow - workflowcontract.v1.CraftingSchema.Runner.RunnerType workflow_run_runner_type = 6 [(buf.validate.field).enum = { - not_in: [0] - }, (buf.validate.field).ignore_empty = true]; + workflowcontract.v1.CraftingSchema.Runner.RunnerType workflow_run_runner_type = 6 [ + (buf.validate.field).enum = { + not_in: [0] + }, + (buf.validate.field).ignore_empty = true + ]; // The status of the last workflow run - RunStatus workflow_run_last_status = 7 [(buf.validate.field).enum = { - not_in: [0] - }, (buf.validate.field).ignore_empty = true]; + RunStatus workflow_run_last_status = 7 [ + (buf.validate.field).enum = { + not_in: [0] + }, + (buf.validate.field).ignore_empty = true + ]; // The time window for the last known workflow activity - WorkflowActivityWindow workflow_last_activity_window = 8 [(buf.validate.field).enum = { - not_in: [0] - }, (buf.validate.field).ignore_empty = true]; + WorkflowActivityWindow workflow_last_activity_window = 8 [ + (buf.validate.field).enum = { + not_in: [0] + }, + (buf.validate.field).ignore_empty = true + ]; // Pagination options OffsetPaginationRequest pagination = 9; // JSON filters to apply to the workflow @@ -159,4 +168,4 @@ enum WorkflowActivityWindow { WORKFLOW_ACTIVITY_WINDOW_LAST_DAY = 1; WORKFLOW_ACTIVITY_WINDOW_LAST_7_DAYS = 2; WORKFLOW_ACTIVITY_WINDOW_LAST_30_DAYS = 3; -} \ No newline at end of file +} diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.proto b/app/controlplane/api/controlplane/v1/workflow_contract.proto index b9fea68f0..a56b6fe75 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.proto +++ b/app/controlplane/api/controlplane/v1/workflow_contract.proto @@ -39,10 +39,10 @@ message WorkflowContractServiceListResponse { message WorkflowContractServiceCreateRequest { string name = 1 [(buf.validate.field) = { cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; // Raw representation of the contract in json, yaml or cue @@ -58,10 +58,10 @@ message WorkflowContractServiceCreateResponse { message WorkflowContractServiceUpdateRequest { string name = 1 [(buf.validate.field) = { cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; // Raw representation of the contract in json, yaml or cue @@ -81,10 +81,10 @@ message WorkflowContractServiceUpdateResponse { message WorkflowContractServiceDescribeRequest { string name = 1 [(buf.validate.field) = { cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; int32 revision = 2; } @@ -100,10 +100,10 @@ message WorkflowContractServiceDescribeResponse { message WorkflowContractServiceDeleteRequest { string name = 1 [(buf.validate.field) = { cel: { - message: "must contain only lowercase letters, numbers, and hyphens.", - expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')", - id: "name.dns-1123", - }, + message: "must contain only lowercase letters, numbers, and hyphens." + expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')" + id: "name.dns-1123" + } }]; } diff --git a/app/controlplane/api/controlplane/v1/workflow_run.proto b/app/controlplane/api/controlplane/v1/workflow_run.proto index ae6f3bff0..d03ef5649 100644 --- a/app/controlplane/api/controlplane/v1/workflow_run.proto +++ b/app/controlplane/api/controlplane/v1/workflow_run.proto @@ -145,9 +145,9 @@ message AttestationServiceInitResponse { message AttestationServiceStoreRequest { // encoded DSEE envelope - bytes attestation = 1 [deprecated=true]; + bytes attestation = 1 [deprecated = true]; // deprecated because of https://github.com/chainloop-dev/chainloop/issues/1832 - bytes bundle = 4 [deprecated=true]; + bytes bundle = 4 [deprecated = true]; // encoded Sigstore attestation bundle bytes attestation_bundle = 5; diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/openapi_metadata.ts b/app/controlplane/api/gen/frontend/controlplane/v1/openapi_metadata.ts new file mode 100644 index 000000000..0df895ada --- /dev/null +++ b/app/controlplane/api/gen/frontend/controlplane/v1/openapi_metadata.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "controlplane.v1"; diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/referrer.ts b/app/controlplane/api/gen/frontend/controlplane/v1/referrer.ts index 1759d5d30..39b6e2892 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/referrer.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/referrer.ts @@ -6,44 +6,57 @@ import { Timestamp } from "../../google/protobuf/timestamp"; export const protobufPackage = "controlplane.v1"; +/** ReferrerServiceDiscoverPrivateRequest is the request for the DiscoverPrivate method */ export interface ReferrerServiceDiscoverPrivateRequest { + /** Digest is the unique identifier of the referrer to discover */ digest: string; /** - * Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + * Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... * Used to filter and resolve ambiguities */ kind: string; } +/** DiscoverPublicSharedRequest is the request for the DiscoverPublicShared method */ export interface DiscoverPublicSharedRequest { + /** Digest is the unique identifier of the referrer to discover */ digest: string; /** - * Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + * Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... * Used to filter and resolve ambiguities */ kind: string; } +/** DiscoverPublicSharedResponse is the response for the DiscoverPublicShared method */ export interface DiscoverPublicSharedResponse { + /** Result is the discovered referrer item */ result?: ReferrerItem; } +/** ReferrerServiceDiscoverPrivateResponse is the response for the DiscoverPrivate method */ export interface ReferrerServiceDiscoverPrivateResponse { + /** Result is the discovered referrer item */ result?: ReferrerItem; } +/** ReferrerItem represents a referrer object in the system */ export interface ReferrerItem { /** Digest of the referrer, i.e sha256:deadbeef or sha1:beefdead */ digest: string; /** Kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... */ kind: string; - /** Whether the referrer is downloadable or not from CAS */ + /** Downloadable indicates whether the referrer is downloadable or not from CAS */ downloadable: boolean; - /** Whether the referrer is public since it belongs to a public workflow */ + /** Public indicates whether the referrer is public since it belongs to a public workflow */ public: boolean; + /** References contains the list of related referrer items */ references: ReferrerItem[]; + /** CreatedAt is the timestamp when the referrer was created */ createdAt?: Date; + /** Metadata contains additional descriptive information about the referrer */ metadata: { [key: string]: string }; + /** Annotations are key-value pairs associated with the referrer */ annotations: { [key: string]: string }; } diff --git a/app/controlplane/api/gen/frontend/google/protobuf/descriptor.ts b/app/controlplane/api/gen/frontend/google/protobuf/descriptor.ts index 0d2d2fb32..d59b21da4 100644 --- a/app/controlplane/api/gen/frontend/google/protobuf/descriptor.ts +++ b/app/controlplane/api/gen/frontend/google/protobuf/descriptor.ts @@ -30,7 +30,7 @@ export enum Edition { EDITION_2024 = 1001, /** * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be - * used or relyed on outside of tests. + * used or relied on outside of tests. */ EDITION_1_TEST_ONLY = 1, EDITION_2_TEST_ONLY = 2, @@ -875,12 +875,13 @@ export interface MessageOptions { export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific * options below. This option is only implemented to support use of * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - * type "bytes" in the open source release -- sorry, we'll try to include - * other types in a future version! + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ ctype: FieldOptions_CType; /** @@ -1052,11 +1053,7 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } -/** - * If set to RETENTION_SOURCE, the option will be omitted from the binary. - * Note: as of January 2023, support for this is in progress and does not yet - * have an effect (b/264593489). - */ +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ export enum FieldOptions_OptionRetention { RETENTION_UNKNOWN = 0, RETENTION_RUNTIME = 1, @@ -1099,8 +1096,7 @@ export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRe /** * This indicates the types of entities that the field may apply to when used * as an option. If it is unset, then the field may be freely used as an - * option on any kind of entity. Note: as of January 2023, support for this is - * in progress and does not yet have an effect (b/264593489). + * option on any kind of entity. */ export enum FieldOptions_OptionTargetType { TARGET_TYPE_UNKNOWN = 0, diff --git a/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/annotations.ts b/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/annotations.ts new file mode 100644 index 000000000..3d76fabb9 --- /dev/null +++ b/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/annotations.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "grpc.gateway.protoc_gen_openapiv2.options"; diff --git a/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/openapiv2.ts b/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/openapiv2.ts new file mode 100644 index 000000000..31cd8c363 --- /dev/null +++ b/app/controlplane/api/gen/frontend/protoc-gen-openapiv2/options/openapiv2.ts @@ -0,0 +1,5190 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Value } from "../../google/protobuf/struct"; + +export const protobufPackage = "grpc.gateway.protoc_gen_openapiv2.options"; + +/** + * Scheme describes the schemes supported by the OpenAPI Swagger + * and Operation objects. + */ +export enum Scheme { + UNKNOWN = 0, + HTTP = 1, + HTTPS = 2, + WS = 3, + WSS = 4, + UNRECOGNIZED = -1, +} + +export function schemeFromJSON(object: any): Scheme { + switch (object) { + case 0: + case "UNKNOWN": + return Scheme.UNKNOWN; + case 1: + case "HTTP": + return Scheme.HTTP; + case 2: + case "HTTPS": + return Scheme.HTTPS; + case 3: + case "WS": + return Scheme.WS; + case 4: + case "WSS": + return Scheme.WSS; + case -1: + case "UNRECOGNIZED": + default: + return Scheme.UNRECOGNIZED; + } +} + +export function schemeToJSON(object: Scheme): string { + switch (object) { + case Scheme.UNKNOWN: + return "UNKNOWN"; + case Scheme.HTTP: + return "HTTP"; + case Scheme.HTTPS: + return "HTTPS"; + case Scheme.WS: + return "WS"; + case Scheme.WSS: + return "WSS"; + case Scheme.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * `Swagger` is a representation of OpenAPI v2 specification's Swagger object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + * info: { + * title: "Echo API"; + * version: "1.0"; + * description: ""; + * contact: { + * name: "gRPC-Gateway project"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway"; + * email: "none@example.com"; + * }; + * license: { + * name: "BSD 3-Clause License"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; + * }; + * }; + * schemes: HTTPS; + * consumes: "application/json"; + * produces: "application/json"; + * }; + */ +export interface Swagger { + /** + * Specifies the OpenAPI Specification version being used. It can be + * used by the OpenAPI UI and other clients to interpret the API listing. The + * value MUST be "2.0". + */ + swagger: string; + /** + * Provides metadata about the API. The metadata can be used by the + * clients if needed. + */ + info?: Info; + /** + * The host (name or ip) serving the API. This MUST be the host only and does + * not include the scheme nor sub-paths. It MAY include a port. If the host is + * not included, the host serving the documentation is to be used (including + * the port). The host does not support path templating. + */ + host: string; + /** + * The base path on which the API is served, which is relative to the host. If + * it is not included, the API is served directly under the host. The value + * MUST start with a leading slash (/). The basePath does not support path + * templating. + * Note that using `base_path` does not change the endpoint paths that are + * generated in the resulting OpenAPI file. If you wish to use `base_path` + * with relatively generated OpenAPI paths, the `base_path` prefix must be + * manually removed from your `google.api.http` paths and your code changed to + * serve the API from the `base_path`. + */ + basePath: string; + /** + * The transfer protocol of the API. Values MUST be from the list: "http", + * "https", "ws", "wss". If the schemes is not included, the default scheme to + * be used is the one used to access the OpenAPI definition itself. + */ + schemes: Scheme[]; + /** + * A list of MIME types the APIs can consume. This is global to all APIs but + * can be overridden on specific API calls. Value MUST be as described under + * Mime Types. + */ + consumes: string[]; + /** + * A list of MIME types the APIs can produce. This is global to all APIs but + * can be overridden on specific API calls. Value MUST be as described under + * Mime Types. + */ + produces: string[]; + /** + * An object to hold responses that can be used across operations. This + * property does not define global responses for all operations. + */ + responses: { [key: string]: Response }; + /** Security scheme definitions that can be used across the specification. */ + securityDefinitions?: SecurityDefinitions; + /** + * A declaration of which security schemes are applied for the API as a whole. + * The list of values describes alternative security schemes that can be used + * (that is, there is a logical OR between the security requirements). + * Individual operations can override this definition. + */ + security: SecurityRequirement[]; + /** + * A list of tags for API documentation control. Tags can be used for logical + * grouping of operations by resources or any other qualifier. + */ + tags: Tag[]; + /** Additional external documentation. */ + externalDocs?: ExternalDocumentation; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export interface Swagger_ResponsesEntry { + key: string; + value?: Response; +} + +export interface Swagger_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `Operation` is a representation of OpenAPI v2 specification's Operation object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject + * + * Example: + * + * service EchoService { + * rpc Echo(SimpleMessage) returns (SimpleMessage) { + * option (google.api.http) = { + * get: "/v1/example/echo/{id}" + * }; + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + * summary: "Get a message."; + * operation_id: "getMessage"; + * tags: "echo"; + * responses: { + * key: "200" + * value: { + * description: "OK"; + * } + * } + * }; + * } + * } + */ +export interface Operation { + /** + * A list of tags for API documentation control. Tags can be used for logical + * grouping of operations by resources or any other qualifier. + */ + tags: string[]; + /** + * A short summary of what the operation does. For maximum readability in the + * swagger-ui, this field SHOULD be less than 120 characters. + */ + summary: string; + /** + * A verbose explanation of the operation behavior. GFM syntax can be used for + * rich text representation. + */ + description: string; + /** Additional external documentation for this operation. */ + externalDocs?: ExternalDocumentation; + /** + * Unique string used to identify the operation. The id MUST be unique among + * all operations described in the API. Tools and libraries MAY use the + * operationId to uniquely identify an operation, therefore, it is recommended + * to follow common programming naming conventions. + */ + operationId: string; + /** + * A list of MIME types the operation can consume. This overrides the consumes + * definition at the OpenAPI Object. An empty value MAY be used to clear the + * global definition. Value MUST be as described under Mime Types. + */ + consumes: string[]; + /** + * A list of MIME types the operation can produce. This overrides the produces + * definition at the OpenAPI Object. An empty value MAY be used to clear the + * global definition. Value MUST be as described under Mime Types. + */ + produces: string[]; + /** + * The list of possible responses as they are returned from executing this + * operation. + */ + responses: { [key: string]: Response }; + /** + * The transfer protocol for the operation. Values MUST be from the list: + * "http", "https", "ws", "wss". The value overrides the OpenAPI Object + * schemes definition. + */ + schemes: Scheme[]; + /** + * Declares this operation to be deprecated. Usage of the declared operation + * should be refrained. Default value is false. + */ + deprecated: boolean; + /** + * A declaration of which security schemes are applied for this operation. The + * list of values describes alternative security schemes that can be used + * (that is, there is a logical OR between the security requirements). This + * definition overrides any declared top-level security. To remove a top-level + * security declaration, an empty array can be used. + */ + security: SecurityRequirement[]; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; + /** + * Custom parameters such as HTTP request headers. + * See: https://swagger.io/docs/specification/2-0/describing-parameters/ + * and https://swagger.io/specification/v2/#parameter-object. + */ + parameters?: Parameters; +} + +export interface Operation_ResponsesEntry { + key: string; + value?: Response; +} + +export interface Operation_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `Parameters` is a representation of OpenAPI v2 specification's parameters object. + * Note: This technically breaks compatibility with the OpenAPI 2 definition structure as we only + * allow header parameters to be set here since we do not want users specifying custom non-header + * parameters beyond those inferred from the Protobuf schema. + * See: https://swagger.io/specification/v2/#parameter-object + */ +export interface Parameters { + /** + * `Headers` is one or more HTTP header parameter. + * See: https://swagger.io/docs/specification/2-0/describing-parameters/#header-parameters + */ + headers: HeaderParameter[]; +} + +/** + * `HeaderParameter` a HTTP header parameter. + * See: https://swagger.io/specification/v2/#parameter-object + */ +export interface HeaderParameter { + /** `Name` is the header name. */ + name: string; + /** `Description` is a short description of the header. */ + description: string; + /** + * `Type` is the type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. + * See: https://swagger.io/specification/v2/#parameterType. + */ + type: HeaderParameter_Type; + /** `Format` The extending format for the previously mentioned type. */ + format: string; + /** `Required` indicates if the header is optional */ + required: boolean; +} + +/** + * `Type` is a supported HTTP header type. + * See https://swagger.io/specification/v2/#parameterType. + */ +export enum HeaderParameter_Type { + UNKNOWN = 0, + STRING = 1, + NUMBER = 2, + INTEGER = 3, + BOOLEAN = 4, + UNRECOGNIZED = -1, +} + +export function headerParameter_TypeFromJSON(object: any): HeaderParameter_Type { + switch (object) { + case 0: + case "UNKNOWN": + return HeaderParameter_Type.UNKNOWN; + case 1: + case "STRING": + return HeaderParameter_Type.STRING; + case 2: + case "NUMBER": + return HeaderParameter_Type.NUMBER; + case 3: + case "INTEGER": + return HeaderParameter_Type.INTEGER; + case 4: + case "BOOLEAN": + return HeaderParameter_Type.BOOLEAN; + case -1: + case "UNRECOGNIZED": + default: + return HeaderParameter_Type.UNRECOGNIZED; + } +} + +export function headerParameter_TypeToJSON(object: HeaderParameter_Type): string { + switch (object) { + case HeaderParameter_Type.UNKNOWN: + return "UNKNOWN"; + case HeaderParameter_Type.STRING: + return "STRING"; + case HeaderParameter_Type.NUMBER: + return "NUMBER"; + case HeaderParameter_Type.INTEGER: + return "INTEGER"; + case HeaderParameter_Type.BOOLEAN: + return "BOOLEAN"; + case HeaderParameter_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * `Header` is a representation of OpenAPI v2 specification's Header object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject + */ +export interface Header { + /** `Description` is a short description of the header. */ + description: string; + /** The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. */ + type: string; + /** `Format` The extending format for the previously mentioned type. */ + format: string; + /** + * `Default` Declares the value of the header that the server will use if none is provided. + * See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. + * Unlike JSON Schema this value MUST conform to the defined type for the header. + */ + default: string; + /** 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. */ + pattern: string; +} + +/** + * `Response` is a representation of OpenAPI v2 specification's Response object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject + */ +export interface Response { + /** + * `Description` is a short description of the response. + * GFM syntax can be used for rich text representation. + */ + description: string; + /** + * `Schema` optionally defines the structure of the response. + * If `Schema` is not provided, it means there is no content to the response. + */ + schema?: Schema; + /** + * `Headers` A list of headers that are sent with the response. + * `Header` name is expected to be a string in the canonical format of the MIME header key + * See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey + */ + headers: { [key: string]: Header }; + /** + * `Examples` gives per-mimetype response examples. + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object + */ + examples: { [key: string]: string }; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export interface Response_HeadersEntry { + key: string; + value?: Header; +} + +export interface Response_ExamplesEntry { + key: string; + value: string; +} + +export interface Response_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `Info` is a representation of OpenAPI v2 specification's Info object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + * info: { + * title: "Echo API"; + * version: "1.0"; + * description: ""; + * contact: { + * name: "gRPC-Gateway project"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway"; + * email: "none@example.com"; + * }; + * license: { + * name: "BSD 3-Clause License"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; + * }; + * }; + * ... + * }; + */ +export interface Info { + /** The title of the application. */ + title: string; + /** + * A short description of the application. GFM syntax can be used for rich + * text representation. + */ + description: string; + /** The Terms of Service for the API. */ + termsOfService: string; + /** The contact information for the exposed API. */ + contact?: Contact; + /** The license information for the exposed API. */ + license?: License; + /** + * Provides the version of the application API (not to be confused + * with the specification version). + */ + version: string; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export interface Info_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `Contact` is a representation of OpenAPI v2 specification's Contact object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + * info: { + * ... + * contact: { + * name: "gRPC-Gateway project"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway"; + * email: "none@example.com"; + * }; + * ... + * }; + * ... + * }; + */ +export interface Contact { + /** The identifying name of the contact person/organization. */ + name: string; + /** + * The URL pointing to the contact information. MUST be in the format of a + * URL. + */ + url: string; + /** + * The email address of the contact person/organization. MUST be in the format + * of an email address. + */ + email: string; +} + +/** + * `License` is a representation of OpenAPI v2 specification's License object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + * info: { + * ... + * license: { + * name: "BSD 3-Clause License"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; + * }; + * ... + * }; + * ... + * }; + */ +export interface License { + /** The license name used for the API. */ + name: string; + /** A URL to the license used for the API. MUST be in the format of a URL. */ + url: string; +} + +/** + * `ExternalDocumentation` is a representation of OpenAPI v2 specification's + * ExternalDocumentation object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + * ... + * external_docs: { + * description: "More about gRPC-Gateway"; + * url: "https://github.com/grpc-ecosystem/grpc-gateway"; + * } + * ... + * }; + */ +export interface ExternalDocumentation { + /** + * A short description of the target documentation. GFM syntax can be used for + * rich text representation. + */ + description: string; + /** + * The URL for the target documentation. Value MUST be in the format + * of a URL. + */ + url: string; +} + +/** + * `Schema` is a representation of OpenAPI v2 specification's Schema object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject + */ +export interface Schema { + jsonSchema?: JSONSchema; + /** + * Adds support for polymorphism. The discriminator is the schema property + * name that is used to differentiate between other schema that inherit this + * schema. The property name used MUST be defined at this schema and it MUST + * be in the required property list. When used, the value MUST be the name of + * this schema or any schema that inherits it. + */ + discriminator: string; + /** + * Relevant only for Schema "properties" definitions. Declares the property as + * "read only". This means that it MAY be sent as part of a response but MUST + * NOT be sent as part of the request. Properties marked as readOnly being + * true SHOULD NOT be in the required list of the defined schema. Default + * value is false. + */ + readOnly: boolean; + /** Additional external documentation for this schema. */ + externalDocs?: ExternalDocumentation; + /** + * A free-form property to include an example of an instance for this schema in JSON. + * This is copied verbatim to the output. + */ + example: string; +} + +/** + * `EnumSchema` is subset of fields from the OpenAPI v2 specification's Schema object. + * Only fields that are applicable to Enums are included + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject + * + * Example: + * + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_enum) = { + * ... + * title: "MyEnum"; + * description:"This is my nice enum"; + * example: "ZERO"; + * required: true; + * ... + * }; + */ +export interface EnumSchema { + /** A short description of the schema. */ + description: string; + default: string; + /** The title of the schema. */ + title: string; + required: boolean; + readOnly: boolean; + /** Additional external documentation for this schema. */ + externalDocs?: ExternalDocumentation; + example: string; + /** + * Ref is used to define an external reference to include in the message. + * This could be a fully qualified proto message reference, and that type must + * be imported into the protofile. If no message is identified, the Ref will + * be used verbatim in the output. + * For example: + * `ref: ".google.protobuf.Timestamp"`. + */ + ref: string; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export interface EnumSchema_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `JSONSchema` represents properties from JSON Schema taken, and as used, in + * the OpenAPI v2 spec. + * + * This includes changes made by OpenAPI v2. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject + * + * See also: https://cswr.github.io/JsonSchema/spec/basic_types/, + * https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json + * + * Example: + * + * message SimpleMessage { + * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + * json_schema: { + * title: "SimpleMessage" + * description: "A simple message." + * required: ["id"] + * } + * }; + * + * // Id represents the message identifier. + * string id = 1; [ + * (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + * description: "The unique identifier of the simple message." + * }]; + * } + */ +export interface JSONSchema { + /** + * Ref is used to define an external reference to include in the message. + * This could be a fully qualified proto message reference, and that type must + * be imported into the protofile. If no message is identified, the Ref will + * be used verbatim in the output. + * For example: + * `ref: ".google.protobuf.Timestamp"`. + */ + ref: string; + /** The title of the schema. */ + title: string; + /** A short description of the schema. */ + description: string; + default: string; + readOnly: boolean; + /** + * A free-form property to include a JSON example of this field. This is copied + * verbatim to the output swagger.json. Quotes must be escaped. + * This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject + */ + example: string; + multipleOf: number; + /** + * Maximum represents an inclusive upper limit for a numeric instance. The + * value of MUST be a number, + */ + maximum: number; + exclusiveMaximum: boolean; + /** + * minimum represents an inclusive lower limit for a numeric instance. The + * value of MUST be a number, + */ + minimum: number; + exclusiveMinimum: boolean; + maxLength: number; + minLength: number; + pattern: string; + maxItems: number; + minItems: number; + uniqueItems: boolean; + maxProperties: number; + minProperties: number; + required: string[]; + /** Items in 'array' must be unique. */ + array: string[]; + type: JSONSchema_JSONSchemaSimpleTypes[]; + /** `Format` */ + format: string; + /** Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 */ + enum: string[]; + /** Additional field level properties used when generating the OpenAPI v2 file. */ + fieldConfiguration?: JSONSchema_FieldConfiguration; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export enum JSONSchema_JSONSchemaSimpleTypes { + UNKNOWN = 0, + ARRAY = 1, + BOOLEAN = 2, + INTEGER = 3, + NULL = 4, + NUMBER = 5, + OBJECT = 6, + STRING = 7, + UNRECOGNIZED = -1, +} + +export function jSONSchema_JSONSchemaSimpleTypesFromJSON(object: any): JSONSchema_JSONSchemaSimpleTypes { + switch (object) { + case 0: + case "UNKNOWN": + return JSONSchema_JSONSchemaSimpleTypes.UNKNOWN; + case 1: + case "ARRAY": + return JSONSchema_JSONSchemaSimpleTypes.ARRAY; + case 2: + case "BOOLEAN": + return JSONSchema_JSONSchemaSimpleTypes.BOOLEAN; + case 3: + case "INTEGER": + return JSONSchema_JSONSchemaSimpleTypes.INTEGER; + case 4: + case "NULL": + return JSONSchema_JSONSchemaSimpleTypes.NULL; + case 5: + case "NUMBER": + return JSONSchema_JSONSchemaSimpleTypes.NUMBER; + case 6: + case "OBJECT": + return JSONSchema_JSONSchemaSimpleTypes.OBJECT; + case 7: + case "STRING": + return JSONSchema_JSONSchemaSimpleTypes.STRING; + case -1: + case "UNRECOGNIZED": + default: + return JSONSchema_JSONSchemaSimpleTypes.UNRECOGNIZED; + } +} + +export function jSONSchema_JSONSchemaSimpleTypesToJSON(object: JSONSchema_JSONSchemaSimpleTypes): string { + switch (object) { + case JSONSchema_JSONSchemaSimpleTypes.UNKNOWN: + return "UNKNOWN"; + case JSONSchema_JSONSchemaSimpleTypes.ARRAY: + return "ARRAY"; + case JSONSchema_JSONSchemaSimpleTypes.BOOLEAN: + return "BOOLEAN"; + case JSONSchema_JSONSchemaSimpleTypes.INTEGER: + return "INTEGER"; + case JSONSchema_JSONSchemaSimpleTypes.NULL: + return "NULL"; + case JSONSchema_JSONSchemaSimpleTypes.NUMBER: + return "NUMBER"; + case JSONSchema_JSONSchemaSimpleTypes.OBJECT: + return "OBJECT"; + case JSONSchema_JSONSchemaSimpleTypes.STRING: + return "STRING"; + case JSONSchema_JSONSchemaSimpleTypes.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file. + * These properties are not defined by OpenAPIv2, but they are used to control the generation. + */ +export interface JSONSchema_FieldConfiguration { + /** + * Alternative parameter name when used as path parameter. If set, this will + * be used as the complete parameter name when this field is used as a path + * parameter. Use this to avoid having auto generated path parameter names + * for overlapping paths. + */ + pathParamName: string; +} + +export interface JSONSchema_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `Tag` is a representation of OpenAPI v2 specification's Tag object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject + */ +export interface Tag { + /** + * The name of the tag. Use it to allow override of the name of a + * global Tag object, then use that name to reference the tag throughout the + * OpenAPI file. + */ + name: string; + /** + * A short description for the tag. GFM syntax can be used for rich text + * representation. + */ + description: string; + /** Additional external documentation for this tag. */ + externalDocs?: ExternalDocumentation; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +export interface Tag_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `SecurityDefinitions` is a representation of OpenAPI v2 specification's + * Security Definitions object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject + * + * A declaration of the security schemes available to be used in the + * specification. This does not enforce the security schemes on the operations + * and only serves to provide the relevant details for each scheme. + */ +export interface SecurityDefinitions { + /** + * A single security scheme definition, mapping a "name" to the scheme it + * defines. + */ + security: { [key: string]: SecurityScheme }; +} + +export interface SecurityDefinitions_SecurityEntry { + key: string; + value?: SecurityScheme; +} + +/** + * `SecurityScheme` is a representation of OpenAPI v2 specification's + * Security Scheme object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject + * + * Allows the definition of a security scheme that can be used by the + * operations. Supported schemes are basic authentication, an API key (either as + * a header or as a query parameter) and OAuth2's common flows (implicit, + * password, application and access code). + */ +export interface SecurityScheme { + /** + * The type of the security scheme. Valid values are "basic", + * "apiKey" or "oauth2". + */ + type: SecurityScheme_Type; + /** A short description for security scheme. */ + description: string; + /** + * The name of the header or query parameter to be used. + * Valid for apiKey. + */ + name: string; + /** + * The location of the API key. Valid values are "query" or + * "header". + * Valid for apiKey. + */ + in: SecurityScheme_In; + /** + * The flow used by the OAuth2 security scheme. Valid values are + * "implicit", "password", "application" or "accessCode". + * Valid for oauth2. + */ + flow: SecurityScheme_Flow; + /** + * The authorization URL to be used for this flow. This SHOULD be in + * the form of a URL. + * Valid for oauth2/implicit and oauth2/accessCode. + */ + authorizationUrl: string; + /** + * The token URL to be used for this flow. This SHOULD be in the + * form of a URL. + * Valid for oauth2/password, oauth2/application and oauth2/accessCode. + */ + tokenUrl: string; + /** + * The available scopes for the OAuth2 security scheme. + * Valid for oauth2. + */ + scopes?: Scopes; + /** + * Custom properties that start with "x-" such as "x-foo" used to describe + * extra functionality that is not covered by the standard OpenAPI Specification. + * See: https://swagger.io/docs/specification/2-0/swagger-extensions/ + */ + extensions: { [key: string]: any }; +} + +/** + * The type of the security scheme. Valid values are "basic", + * "apiKey" or "oauth2". + */ +export enum SecurityScheme_Type { + TYPE_INVALID = 0, + TYPE_BASIC = 1, + TYPE_API_KEY = 2, + TYPE_OAUTH2 = 3, + UNRECOGNIZED = -1, +} + +export function securityScheme_TypeFromJSON(object: any): SecurityScheme_Type { + switch (object) { + case 0: + case "TYPE_INVALID": + return SecurityScheme_Type.TYPE_INVALID; + case 1: + case "TYPE_BASIC": + return SecurityScheme_Type.TYPE_BASIC; + case 2: + case "TYPE_API_KEY": + return SecurityScheme_Type.TYPE_API_KEY; + case 3: + case "TYPE_OAUTH2": + return SecurityScheme_Type.TYPE_OAUTH2; + case -1: + case "UNRECOGNIZED": + default: + return SecurityScheme_Type.UNRECOGNIZED; + } +} + +export function securityScheme_TypeToJSON(object: SecurityScheme_Type): string { + switch (object) { + case SecurityScheme_Type.TYPE_INVALID: + return "TYPE_INVALID"; + case SecurityScheme_Type.TYPE_BASIC: + return "TYPE_BASIC"; + case SecurityScheme_Type.TYPE_API_KEY: + return "TYPE_API_KEY"; + case SecurityScheme_Type.TYPE_OAUTH2: + return "TYPE_OAUTH2"; + case SecurityScheme_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** The location of the API key. Valid values are "query" or "header". */ +export enum SecurityScheme_In { + IN_INVALID = 0, + IN_QUERY = 1, + IN_HEADER = 2, + UNRECOGNIZED = -1, +} + +export function securityScheme_InFromJSON(object: any): SecurityScheme_In { + switch (object) { + case 0: + case "IN_INVALID": + return SecurityScheme_In.IN_INVALID; + case 1: + case "IN_QUERY": + return SecurityScheme_In.IN_QUERY; + case 2: + case "IN_HEADER": + return SecurityScheme_In.IN_HEADER; + case -1: + case "UNRECOGNIZED": + default: + return SecurityScheme_In.UNRECOGNIZED; + } +} + +export function securityScheme_InToJSON(object: SecurityScheme_In): string { + switch (object) { + case SecurityScheme_In.IN_INVALID: + return "IN_INVALID"; + case SecurityScheme_In.IN_QUERY: + return "IN_QUERY"; + case SecurityScheme_In.IN_HEADER: + return "IN_HEADER"; + case SecurityScheme_In.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * The flow used by the OAuth2 security scheme. Valid values are + * "implicit", "password", "application" or "accessCode". + */ +export enum SecurityScheme_Flow { + FLOW_INVALID = 0, + FLOW_IMPLICIT = 1, + FLOW_PASSWORD = 2, + FLOW_APPLICATION = 3, + FLOW_ACCESS_CODE = 4, + UNRECOGNIZED = -1, +} + +export function securityScheme_FlowFromJSON(object: any): SecurityScheme_Flow { + switch (object) { + case 0: + case "FLOW_INVALID": + return SecurityScheme_Flow.FLOW_INVALID; + case 1: + case "FLOW_IMPLICIT": + return SecurityScheme_Flow.FLOW_IMPLICIT; + case 2: + case "FLOW_PASSWORD": + return SecurityScheme_Flow.FLOW_PASSWORD; + case 3: + case "FLOW_APPLICATION": + return SecurityScheme_Flow.FLOW_APPLICATION; + case 4: + case "FLOW_ACCESS_CODE": + return SecurityScheme_Flow.FLOW_ACCESS_CODE; + case -1: + case "UNRECOGNIZED": + default: + return SecurityScheme_Flow.UNRECOGNIZED; + } +} + +export function securityScheme_FlowToJSON(object: SecurityScheme_Flow): string { + switch (object) { + case SecurityScheme_Flow.FLOW_INVALID: + return "FLOW_INVALID"; + case SecurityScheme_Flow.FLOW_IMPLICIT: + return "FLOW_IMPLICIT"; + case SecurityScheme_Flow.FLOW_PASSWORD: + return "FLOW_PASSWORD"; + case SecurityScheme_Flow.FLOW_APPLICATION: + return "FLOW_APPLICATION"; + case SecurityScheme_Flow.FLOW_ACCESS_CODE: + return "FLOW_ACCESS_CODE"; + case SecurityScheme_Flow.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface SecurityScheme_ExtensionsEntry { + key: string; + value?: any; +} + +/** + * `SecurityRequirement` is a representation of OpenAPI v2 specification's + * Security Requirement object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject + * + * Lists the required security schemes to execute this operation. The object can + * have multiple security schemes declared in it which are all required (that + * is, there is a logical AND between the schemes). + * + * The name used for each property MUST correspond to a security scheme + * declared in the Security Definitions. + */ +export interface SecurityRequirement { + /** + * Each name must correspond to a security scheme which is declared in + * the Security Definitions. If the security scheme is of type "oauth2", + * then the value is a list of scope names required for the execution. + * For other security scheme types, the array MUST be empty. + */ + securityRequirement: { [key: string]: SecurityRequirement_SecurityRequirementValue }; +} + +/** + * If the security scheme is of type "oauth2", then the value is a list of + * scope names required for the execution. For other security scheme types, + * the array MUST be empty. + */ +export interface SecurityRequirement_SecurityRequirementValue { + scope: string[]; +} + +export interface SecurityRequirement_SecurityRequirementEntry { + key: string; + value?: SecurityRequirement_SecurityRequirementValue; +} + +/** + * `Scopes` is a representation of OpenAPI v2 specification's Scopes object. + * + * See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject + * + * Lists the available scopes for an OAuth2 security scheme. + */ +export interface Scopes { + /** + * Maps between a name of a scope to a short description of it (as the value + * of the property). + */ + scope: { [key: string]: string }; +} + +export interface Scopes_ScopeEntry { + key: string; + value: string; +} + +function createBaseSwagger(): Swagger { + return { + swagger: "", + info: undefined, + host: "", + basePath: "", + schemes: [], + consumes: [], + produces: [], + responses: {}, + securityDefinitions: undefined, + security: [], + tags: [], + externalDocs: undefined, + extensions: {}, + }; +} + +export const Swagger = { + encode(message: Swagger, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.swagger !== "") { + writer.uint32(10).string(message.swagger); + } + if (message.info !== undefined) { + Info.encode(message.info, writer.uint32(18).fork()).ldelim(); + } + if (message.host !== "") { + writer.uint32(26).string(message.host); + } + if (message.basePath !== "") { + writer.uint32(34).string(message.basePath); + } + writer.uint32(42).fork(); + for (const v of message.schemes) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.consumes) { + writer.uint32(50).string(v!); + } + for (const v of message.produces) { + writer.uint32(58).string(v!); + } + Object.entries(message.responses).forEach(([key, value]) => { + Swagger_ResponsesEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).ldelim(); + }); + if (message.securityDefinitions !== undefined) { + SecurityDefinitions.encode(message.securityDefinitions, writer.uint32(90).fork()).ldelim(); + } + for (const v of message.security) { + SecurityRequirement.encode(v!, writer.uint32(98).fork()).ldelim(); + } + for (const v of message.tags) { + Tag.encode(v!, writer.uint32(106).fork()).ldelim(); + } + if (message.externalDocs !== undefined) { + ExternalDocumentation.encode(message.externalDocs, writer.uint32(114).fork()).ldelim(); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + Swagger_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(122).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Swagger { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSwagger(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.swagger = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.info = Info.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.host = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.basePath = reader.string(); + continue; + case 5: + if (tag === 40) { + message.schemes.push(reader.int32() as any); + + continue; + } + + if (tag === 42) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.schemes.push(reader.int32() as any); + } + + continue; + } + + break; + case 6: + if (tag !== 50) { + break; + } + + message.consumes.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.produces.push(reader.string()); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = Swagger_ResponsesEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.responses[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.securityDefinitions = SecurityDefinitions.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.security.push(SecurityRequirement.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.tags.push(Tag.decode(reader, reader.uint32())); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.externalDocs = ExternalDocumentation.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + const entry15 = Swagger_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry15.value !== undefined) { + message.extensions[entry15.key] = entry15.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Swagger { + return { + swagger: isSet(object.swagger) ? String(object.swagger) : "", + info: isSet(object.info) ? Info.fromJSON(object.info) : undefined, + host: isSet(object.host) ? String(object.host) : "", + basePath: isSet(object.basePath) ? String(object.basePath) : "", + schemes: Array.isArray(object?.schemes) ? object.schemes.map((e: any) => schemeFromJSON(e)) : [], + consumes: Array.isArray(object?.consumes) ? object.consumes.map((e: any) => String(e)) : [], + produces: Array.isArray(object?.produces) ? object.produces.map((e: any) => String(e)) : [], + responses: isObject(object.responses) + ? Object.entries(object.responses).reduce<{ [key: string]: Response }>((acc, [key, value]) => { + acc[key] = Response.fromJSON(value); + return acc; + }, {}) + : {}, + securityDefinitions: isSet(object.securityDefinitions) + ? SecurityDefinitions.fromJSON(object.securityDefinitions) + : undefined, + security: Array.isArray(object?.security) ? object.security.map((e: any) => SecurityRequirement.fromJSON(e)) : [], + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => Tag.fromJSON(e)) : [], + externalDocs: isSet(object.externalDocs) ? ExternalDocumentation.fromJSON(object.externalDocs) : undefined, + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Swagger): unknown { + const obj: any = {}; + message.swagger !== undefined && (obj.swagger = message.swagger); + message.info !== undefined && (obj.info = message.info ? Info.toJSON(message.info) : undefined); + message.host !== undefined && (obj.host = message.host); + message.basePath !== undefined && (obj.basePath = message.basePath); + if (message.schemes) { + obj.schemes = message.schemes.map((e) => schemeToJSON(e)); + } else { + obj.schemes = []; + } + if (message.consumes) { + obj.consumes = message.consumes.map((e) => e); + } else { + obj.consumes = []; + } + if (message.produces) { + obj.produces = message.produces.map((e) => e); + } else { + obj.produces = []; + } + obj.responses = {}; + if (message.responses) { + Object.entries(message.responses).forEach(([k, v]) => { + obj.responses[k] = Response.toJSON(v); + }); + } + message.securityDefinitions !== undefined && (obj.securityDefinitions = message.securityDefinitions + ? SecurityDefinitions.toJSON(message.securityDefinitions) + : undefined); + if (message.security) { + obj.security = message.security.map((e) => e ? SecurityRequirement.toJSON(e) : undefined); + } else { + obj.security = []; + } + if (message.tags) { + obj.tags = message.tags.map((e) => e ? Tag.toJSON(e) : undefined); + } else { + obj.tags = []; + } + message.externalDocs !== undefined && + (obj.externalDocs = message.externalDocs ? ExternalDocumentation.toJSON(message.externalDocs) : undefined); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): Swagger { + return Swagger.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Swagger { + const message = createBaseSwagger(); + message.swagger = object.swagger ?? ""; + message.info = (object.info !== undefined && object.info !== null) ? Info.fromPartial(object.info) : undefined; + message.host = object.host ?? ""; + message.basePath = object.basePath ?? ""; + message.schemes = object.schemes?.map((e) => e) || []; + message.consumes = object.consumes?.map((e) => e) || []; + message.produces = object.produces?.map((e) => e) || []; + message.responses = Object.entries(object.responses ?? {}).reduce<{ [key: string]: Response }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Response.fromPartial(value); + } + return acc; + }, + {}, + ); + message.securityDefinitions = (object.securityDefinitions !== undefined && object.securityDefinitions !== null) + ? SecurityDefinitions.fromPartial(object.securityDefinitions) + : undefined; + message.security = object.security?.map((e) => SecurityRequirement.fromPartial(e)) || []; + message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || []; + message.externalDocs = (object.externalDocs !== undefined && object.externalDocs !== null) + ? ExternalDocumentation.fromPartial(object.externalDocs) + : undefined; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseSwagger_ResponsesEntry(): Swagger_ResponsesEntry { + return { key: "", value: undefined }; +} + +export const Swagger_ResponsesEntry = { + encode(message: Swagger_ResponsesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Response.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Swagger_ResponsesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSwagger_ResponsesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Response.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Swagger_ResponsesEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? Response.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Swagger_ResponsesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? Response.toJSON(message.value) : undefined); + return obj; + }, + + create, I>>(base?: I): Swagger_ResponsesEntry { + return Swagger_ResponsesEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Swagger_ResponsesEntry { + const message = createBaseSwagger_ResponsesEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Response.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseSwagger_ExtensionsEntry(): Swagger_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const Swagger_ExtensionsEntry = { + encode(message: Swagger_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Swagger_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSwagger_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Swagger_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Swagger_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Swagger_ExtensionsEntry { + return Swagger_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Swagger_ExtensionsEntry { + const message = createBaseSwagger_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseOperation(): Operation { + return { + tags: [], + summary: "", + description: "", + externalDocs: undefined, + operationId: "", + consumes: [], + produces: [], + responses: {}, + schemes: [], + deprecated: false, + security: [], + extensions: {}, + parameters: undefined, + }; +} + +export const Operation = { + encode(message: Operation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.tags) { + writer.uint32(10).string(v!); + } + if (message.summary !== "") { + writer.uint32(18).string(message.summary); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.externalDocs !== undefined) { + ExternalDocumentation.encode(message.externalDocs, writer.uint32(34).fork()).ldelim(); + } + if (message.operationId !== "") { + writer.uint32(42).string(message.operationId); + } + for (const v of message.consumes) { + writer.uint32(50).string(v!); + } + for (const v of message.produces) { + writer.uint32(58).string(v!); + } + Object.entries(message.responses).forEach(([key, value]) => { + Operation_ResponsesEntry.encode({ key: key as any, value }, writer.uint32(74).fork()).ldelim(); + }); + writer.uint32(82).fork(); + for (const v of message.schemes) { + writer.int32(v); + } + writer.ldelim(); + if (message.deprecated === true) { + writer.uint32(88).bool(message.deprecated); + } + for (const v of message.security) { + SecurityRequirement.encode(v!, writer.uint32(98).fork()).ldelim(); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + Operation_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(106).fork()).ldelim(); + } + }); + if (message.parameters !== undefined) { + Parameters.encode(message.parameters, writer.uint32(114).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Operation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOperation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tags.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.summary = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.description = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.externalDocs = ExternalDocumentation.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.operationId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.consumes.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.produces.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + const entry9 = Operation_ResponsesEntry.decode(reader, reader.uint32()); + if (entry9.value !== undefined) { + message.responses[entry9.key] = entry9.value; + } + continue; + case 10: + if (tag === 80) { + message.schemes.push(reader.int32() as any); + + continue; + } + + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.schemes.push(reader.int32() as any); + } + + continue; + } + + break; + case 11: + if (tag !== 88) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.security.push(SecurityRequirement.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + const entry13 = Operation_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry13.value !== undefined) { + message.extensions[entry13.key] = entry13.value; + } + continue; + case 14: + if (tag !== 114) { + break; + } + + message.parameters = Parameters.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Operation { + return { + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => String(e)) : [], + summary: isSet(object.summary) ? String(object.summary) : "", + description: isSet(object.description) ? String(object.description) : "", + externalDocs: isSet(object.externalDocs) ? ExternalDocumentation.fromJSON(object.externalDocs) : undefined, + operationId: isSet(object.operationId) ? String(object.operationId) : "", + consumes: Array.isArray(object?.consumes) ? object.consumes.map((e: any) => String(e)) : [], + produces: Array.isArray(object?.produces) ? object.produces.map((e: any) => String(e)) : [], + responses: isObject(object.responses) + ? Object.entries(object.responses).reduce<{ [key: string]: Response }>((acc, [key, value]) => { + acc[key] = Response.fromJSON(value); + return acc; + }, {}) + : {}, + schemes: Array.isArray(object?.schemes) ? object.schemes.map((e: any) => schemeFromJSON(e)) : [], + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + security: Array.isArray(object?.security) ? object.security.map((e: any) => SecurityRequirement.fromJSON(e)) : [], + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + parameters: isSet(object.parameters) ? Parameters.fromJSON(object.parameters) : undefined, + }; + }, + + toJSON(message: Operation): unknown { + const obj: any = {}; + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + message.summary !== undefined && (obj.summary = message.summary); + message.description !== undefined && (obj.description = message.description); + message.externalDocs !== undefined && + (obj.externalDocs = message.externalDocs ? ExternalDocumentation.toJSON(message.externalDocs) : undefined); + message.operationId !== undefined && (obj.operationId = message.operationId); + if (message.consumes) { + obj.consumes = message.consumes.map((e) => e); + } else { + obj.consumes = []; + } + if (message.produces) { + obj.produces = message.produces.map((e) => e); + } else { + obj.produces = []; + } + obj.responses = {}; + if (message.responses) { + Object.entries(message.responses).forEach(([k, v]) => { + obj.responses[k] = Response.toJSON(v); + }); + } + if (message.schemes) { + obj.schemes = message.schemes.map((e) => schemeToJSON(e)); + } else { + obj.schemes = []; + } + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.security) { + obj.security = message.security.map((e) => e ? SecurityRequirement.toJSON(e) : undefined); + } else { + obj.security = []; + } + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + message.parameters !== undefined && + (obj.parameters = message.parameters ? Parameters.toJSON(message.parameters) : undefined); + return obj; + }, + + create, I>>(base?: I): Operation { + return Operation.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Operation { + const message = createBaseOperation(); + message.tags = object.tags?.map((e) => e) || []; + message.summary = object.summary ?? ""; + message.description = object.description ?? ""; + message.externalDocs = (object.externalDocs !== undefined && object.externalDocs !== null) + ? ExternalDocumentation.fromPartial(object.externalDocs) + : undefined; + message.operationId = object.operationId ?? ""; + message.consumes = object.consumes?.map((e) => e) || []; + message.produces = object.produces?.map((e) => e) || []; + message.responses = Object.entries(object.responses ?? {}).reduce<{ [key: string]: Response }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Response.fromPartial(value); + } + return acc; + }, + {}, + ); + message.schemes = object.schemes?.map((e) => e) || []; + message.deprecated = object.deprecated ?? false; + message.security = object.security?.map((e) => SecurityRequirement.fromPartial(e)) || []; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + message.parameters = (object.parameters !== undefined && object.parameters !== null) + ? Parameters.fromPartial(object.parameters) + : undefined; + return message; + }, +}; + +function createBaseOperation_ResponsesEntry(): Operation_ResponsesEntry { + return { key: "", value: undefined }; +} + +export const Operation_ResponsesEntry = { + encode(message: Operation_ResponsesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Response.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Operation_ResponsesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOperation_ResponsesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Response.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Operation_ResponsesEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? Response.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Operation_ResponsesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? Response.toJSON(message.value) : undefined); + return obj; + }, + + create, I>>(base?: I): Operation_ResponsesEntry { + return Operation_ResponsesEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Operation_ResponsesEntry { + const message = createBaseOperation_ResponsesEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Response.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseOperation_ExtensionsEntry(): Operation_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const Operation_ExtensionsEntry = { + encode(message: Operation_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Operation_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOperation_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Operation_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Operation_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Operation_ExtensionsEntry { + return Operation_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Operation_ExtensionsEntry { + const message = createBaseOperation_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseParameters(): Parameters { + return { headers: [] }; +} + +export const Parameters = { + encode(message: Parameters, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.headers) { + HeaderParameter.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Parameters { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParameters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.headers.push(HeaderParameter.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Parameters { + return { + headers: Array.isArray(object?.headers) ? object.headers.map((e: any) => HeaderParameter.fromJSON(e)) : [], + }; + }, + + toJSON(message: Parameters): unknown { + const obj: any = {}; + if (message.headers) { + obj.headers = message.headers.map((e) => e ? HeaderParameter.toJSON(e) : undefined); + } else { + obj.headers = []; + } + return obj; + }, + + create, I>>(base?: I): Parameters { + return Parameters.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Parameters { + const message = createBaseParameters(); + message.headers = object.headers?.map((e) => HeaderParameter.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHeaderParameter(): HeaderParameter { + return { name: "", description: "", type: 0, format: "", required: false }; +} + +export const HeaderParameter = { + encode(message: HeaderParameter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.type !== 0) { + writer.uint32(24).int32(message.type); + } + if (message.format !== "") { + writer.uint32(34).string(message.format); + } + if (message.required === true) { + writer.uint32(40).bool(message.required); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HeaderParameter { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeaderParameter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.type = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.format = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.required = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): HeaderParameter { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + type: isSet(object.type) ? headerParameter_TypeFromJSON(object.type) : 0, + format: isSet(object.format) ? String(object.format) : "", + required: isSet(object.required) ? Boolean(object.required) : false, + }; + }, + + toJSON(message: HeaderParameter): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + message.type !== undefined && (obj.type = headerParameter_TypeToJSON(message.type)); + message.format !== undefined && (obj.format = message.format); + message.required !== undefined && (obj.required = message.required); + return obj; + }, + + create, I>>(base?: I): HeaderParameter { + return HeaderParameter.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): HeaderParameter { + const message = createBaseHeaderParameter(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.type = object.type ?? 0; + message.format = object.format ?? ""; + message.required = object.required ?? false; + return message; + }, +}; + +function createBaseHeader(): Header { + return { description: "", type: "", format: "", default: "", pattern: "" }; +} + +export const Header = { + encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + if (message.format !== "") { + writer.uint32(26).string(message.format); + } + if (message.default !== "") { + writer.uint32(50).string(message.default); + } + if (message.pattern !== "") { + writer.uint32(106).string(message.pattern); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Header { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.type = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.format = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.default = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.pattern = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + description: isSet(object.description) ? String(object.description) : "", + type: isSet(object.type) ? String(object.type) : "", + format: isSet(object.format) ? String(object.format) : "", + default: isSet(object.default) ? String(object.default) : "", + pattern: isSet(object.pattern) ? String(object.pattern) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + message.type !== undefined && (obj.type = message.type); + message.format !== undefined && (obj.format = message.format); + message.default !== undefined && (obj.default = message.default); + message.pattern !== undefined && (obj.pattern = message.pattern); + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.description = object.description ?? ""; + message.type = object.type ?? ""; + message.format = object.format ?? ""; + message.default = object.default ?? ""; + message.pattern = object.pattern ?? ""; + return message; + }, +}; + +function createBaseResponse(): Response { + return { description: "", schema: undefined, headers: {}, examples: {}, extensions: {} }; +} + +export const Response = { + encode(message: Response, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + if (message.schema !== undefined) { + Schema.encode(message.schema, writer.uint32(18).fork()).ldelim(); + } + Object.entries(message.headers).forEach(([key, value]) => { + Response_HeadersEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim(); + }); + Object.entries(message.examples).forEach(([key, value]) => { + Response_ExamplesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).ldelim(); + }); + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + Response_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.schema = Schema.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = Response_HeadersEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.headers[entry3.key] = entry3.value; + } + continue; + case 4: + if (tag !== 34) { + break; + } + + const entry4 = Response_ExamplesEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.examples[entry4.key] = entry4.value; + } + continue; + case 5: + if (tag !== 42) { + break; + } + + const entry5 = Response_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.extensions[entry5.key] = entry5.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response { + return { + description: isSet(object.description) ? String(object.description) : "", + schema: isSet(object.schema) ? Schema.fromJSON(object.schema) : undefined, + headers: isObject(object.headers) + ? Object.entries(object.headers).reduce<{ [key: string]: Header }>((acc, [key, value]) => { + acc[key] = Header.fromJSON(value); + return acc; + }, {}) + : {}, + examples: isObject(object.examples) + ? Object.entries(object.examples).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + message.schema !== undefined && (obj.schema = message.schema ? Schema.toJSON(message.schema) : undefined); + obj.headers = {}; + if (message.headers) { + Object.entries(message.headers).forEach(([k, v]) => { + obj.headers[k] = Header.toJSON(v); + }); + } + obj.examples = {}; + if (message.examples) { + Object.entries(message.examples).forEach(([k, v]) => { + obj.examples[k] = v; + }); + } + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Response { + const message = createBaseResponse(); + message.description = object.description ?? ""; + message.schema = (object.schema !== undefined && object.schema !== null) + ? Schema.fromPartial(object.schema) + : undefined; + message.headers = Object.entries(object.headers ?? {}).reduce<{ [key: string]: Header }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Header.fromPartial(value); + } + return acc; + }, {}); + message.examples = Object.entries(object.examples ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = String(value); + } + return acc; + }, {}); + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseResponse_HeadersEntry(): Response_HeadersEntry { + return { key: "", value: undefined }; +} + +export const Response_HeadersEntry = { + encode(message: Response_HeadersEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Header.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response_HeadersEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse_HeadersEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Header.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response_HeadersEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? Header.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Response_HeadersEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? Header.toJSON(message.value) : undefined); + return obj; + }, + + create, I>>(base?: I): Response_HeadersEntry { + return Response_HeadersEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Response_HeadersEntry { + const message = createBaseResponse_HeadersEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Header.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResponse_ExamplesEntry(): Response_ExamplesEntry { + return { key: "", value: "" }; +} + +export const Response_ExamplesEntry = { + encode(message: Response_ExamplesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response_ExamplesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse_ExamplesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response_ExamplesEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: Response_ExamplesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Response_ExamplesEntry { + return Response_ExamplesEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Response_ExamplesEntry { + const message = createBaseResponse_ExamplesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseResponse_ExtensionsEntry(): Response_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const Response_ExtensionsEntry = { + encode(message: Response_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Response_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Response_ExtensionsEntry { + return Response_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Response_ExtensionsEntry { + const message = createBaseResponse_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseInfo(): Info { + return { + title: "", + description: "", + termsOfService: "", + contact: undefined, + license: undefined, + version: "", + extensions: {}, + }; +} + +export const Info = { + encode(message: Info, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.termsOfService !== "") { + writer.uint32(26).string(message.termsOfService); + } + if (message.contact !== undefined) { + Contact.encode(message.contact, writer.uint32(34).fork()).ldelim(); + } + if (message.license !== undefined) { + License.encode(message.license, writer.uint32(42).fork()).ldelim(); + } + if (message.version !== "") { + writer.uint32(50).string(message.version); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + Info_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Info { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.termsOfService = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.contact = Contact.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.license = License.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.version = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + const entry7 = Info_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry7.value !== undefined) { + message.extensions[entry7.key] = entry7.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Info { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + termsOfService: isSet(object.termsOfService) ? String(object.termsOfService) : "", + contact: isSet(object.contact) ? Contact.fromJSON(object.contact) : undefined, + license: isSet(object.license) ? License.fromJSON(object.license) : undefined, + version: isSet(object.version) ? String(object.version) : "", + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Info): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.termsOfService !== undefined && (obj.termsOfService = message.termsOfService); + message.contact !== undefined && (obj.contact = message.contact ? Contact.toJSON(message.contact) : undefined); + message.license !== undefined && (obj.license = message.license ? License.toJSON(message.license) : undefined); + message.version !== undefined && (obj.version = message.version); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): Info { + return Info.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Info { + const message = createBaseInfo(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.termsOfService = object.termsOfService ?? ""; + message.contact = (object.contact !== undefined && object.contact !== null) + ? Contact.fromPartial(object.contact) + : undefined; + message.license = (object.license !== undefined && object.license !== null) + ? License.fromPartial(object.license) + : undefined; + message.version = object.version ?? ""; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseInfo_ExtensionsEntry(): Info_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const Info_ExtensionsEntry = { + encode(message: Info_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Info_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInfo_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Info_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Info_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Info_ExtensionsEntry { + return Info_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Info_ExtensionsEntry { + const message = createBaseInfo_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseContact(): Contact { + return { name: "", url: "", email: "" }; +} + +export const Contact = { + encode(message: Contact, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + if (message.email !== "") { + writer.uint32(26).string(message.email); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Contact { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContact(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.email = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Contact { + return { + name: isSet(object.name) ? String(object.name) : "", + url: isSet(object.url) ? String(object.url) : "", + email: isSet(object.email) ? String(object.email) : "", + }; + }, + + toJSON(message: Contact): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.url !== undefined && (obj.url = message.url); + message.email !== undefined && (obj.email = message.email); + return obj; + }, + + create, I>>(base?: I): Contact { + return Contact.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Contact { + const message = createBaseContact(); + message.name = object.name ?? ""; + message.url = object.url ?? ""; + message.email = object.email ?? ""; + return message; + }, +}; + +function createBaseLicense(): License { + return { name: "", url: "" }; +} + +export const License = { + encode(message: License, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): License { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLicense(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): License { + return { name: isSet(object.name) ? String(object.name) : "", url: isSet(object.url) ? String(object.url) : "" }; + }, + + toJSON(message: License): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.url !== undefined && (obj.url = message.url); + return obj; + }, + + create, I>>(base?: I): License { + return License.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): License { + const message = createBaseLicense(); + message.name = object.name ?? ""; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseExternalDocumentation(): ExternalDocumentation { + return { description: "", url: "" }; +} + +export const ExternalDocumentation = { + encode(message: ExternalDocumentation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExternalDocumentation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExternalDocumentation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExternalDocumentation { + return { + description: isSet(object.description) ? String(object.description) : "", + url: isSet(object.url) ? String(object.url) : "", + }; + }, + + toJSON(message: ExternalDocumentation): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + message.url !== undefined && (obj.url = message.url); + return obj; + }, + + create, I>>(base?: I): ExternalDocumentation { + return ExternalDocumentation.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ExternalDocumentation { + const message = createBaseExternalDocumentation(); + message.description = object.description ?? ""; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseSchema(): Schema { + return { jsonSchema: undefined, discriminator: "", readOnly: false, externalDocs: undefined, example: "" }; +} + +export const Schema = { + encode(message: Schema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.jsonSchema !== undefined) { + JSONSchema.encode(message.jsonSchema, writer.uint32(10).fork()).ldelim(); + } + if (message.discriminator !== "") { + writer.uint32(18).string(message.discriminator); + } + if (message.readOnly === true) { + writer.uint32(24).bool(message.readOnly); + } + if (message.externalDocs !== undefined) { + ExternalDocumentation.encode(message.externalDocs, writer.uint32(42).fork()).ldelim(); + } + if (message.example !== "") { + writer.uint32(50).string(message.example); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Schema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.jsonSchema = JSONSchema.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.discriminator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.externalDocs = ExternalDocumentation.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.example = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Schema { + return { + jsonSchema: isSet(object.jsonSchema) ? JSONSchema.fromJSON(object.jsonSchema) : undefined, + discriminator: isSet(object.discriminator) ? String(object.discriminator) : "", + readOnly: isSet(object.readOnly) ? Boolean(object.readOnly) : false, + externalDocs: isSet(object.externalDocs) ? ExternalDocumentation.fromJSON(object.externalDocs) : undefined, + example: isSet(object.example) ? String(object.example) : "", + }; + }, + + toJSON(message: Schema): unknown { + const obj: any = {}; + message.jsonSchema !== undefined && + (obj.jsonSchema = message.jsonSchema ? JSONSchema.toJSON(message.jsonSchema) : undefined); + message.discriminator !== undefined && (obj.discriminator = message.discriminator); + message.readOnly !== undefined && (obj.readOnly = message.readOnly); + message.externalDocs !== undefined && + (obj.externalDocs = message.externalDocs ? ExternalDocumentation.toJSON(message.externalDocs) : undefined); + message.example !== undefined && (obj.example = message.example); + return obj; + }, + + create, I>>(base?: I): Schema { + return Schema.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Schema { + const message = createBaseSchema(); + message.jsonSchema = (object.jsonSchema !== undefined && object.jsonSchema !== null) + ? JSONSchema.fromPartial(object.jsonSchema) + : undefined; + message.discriminator = object.discriminator ?? ""; + message.readOnly = object.readOnly ?? false; + message.externalDocs = (object.externalDocs !== undefined && object.externalDocs !== null) + ? ExternalDocumentation.fromPartial(object.externalDocs) + : undefined; + message.example = object.example ?? ""; + return message; + }, +}; + +function createBaseEnumSchema(): EnumSchema { + return { + description: "", + default: "", + title: "", + required: false, + readOnly: false, + externalDocs: undefined, + example: "", + ref: "", + extensions: {}, + }; +} + +export const EnumSchema = { + encode(message: EnumSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + if (message.default !== "") { + writer.uint32(18).string(message.default); + } + if (message.title !== "") { + writer.uint32(26).string(message.title); + } + if (message.required === true) { + writer.uint32(32).bool(message.required); + } + if (message.readOnly === true) { + writer.uint32(40).bool(message.readOnly); + } + if (message.externalDocs !== undefined) { + ExternalDocumentation.encode(message.externalDocs, writer.uint32(50).fork()).ldelim(); + } + if (message.example !== "") { + writer.uint32(58).string(message.example); + } + if (message.ref !== "") { + writer.uint32(66).string(message.ref); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + EnumSchema_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(74).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumSchema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.default = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.title = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.required = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.readOnly = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.externalDocs = ExternalDocumentation.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.example = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.ref = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + const entry9 = EnumSchema_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry9.value !== undefined) { + message.extensions[entry9.key] = entry9.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumSchema { + return { + description: isSet(object.description) ? String(object.description) : "", + default: isSet(object.default) ? String(object.default) : "", + title: isSet(object.title) ? String(object.title) : "", + required: isSet(object.required) ? Boolean(object.required) : false, + readOnly: isSet(object.readOnly) ? Boolean(object.readOnly) : false, + externalDocs: isSet(object.externalDocs) ? ExternalDocumentation.fromJSON(object.externalDocs) : undefined, + example: isSet(object.example) ? String(object.example) : "", + ref: isSet(object.ref) ? String(object.ref) : "", + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: EnumSchema): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + message.default !== undefined && (obj.default = message.default); + message.title !== undefined && (obj.title = message.title); + message.required !== undefined && (obj.required = message.required); + message.readOnly !== undefined && (obj.readOnly = message.readOnly); + message.externalDocs !== undefined && + (obj.externalDocs = message.externalDocs ? ExternalDocumentation.toJSON(message.externalDocs) : undefined); + message.example !== undefined && (obj.example = message.example); + message.ref !== undefined && (obj.ref = message.ref); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): EnumSchema { + return EnumSchema.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EnumSchema { + const message = createBaseEnumSchema(); + message.description = object.description ?? ""; + message.default = object.default ?? ""; + message.title = object.title ?? ""; + message.required = object.required ?? false; + message.readOnly = object.readOnly ?? false; + message.externalDocs = (object.externalDocs !== undefined && object.externalDocs !== null) + ? ExternalDocumentation.fromPartial(object.externalDocs) + : undefined; + message.example = object.example ?? ""; + message.ref = object.ref ?? ""; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseEnumSchema_ExtensionsEntry(): EnumSchema_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const EnumSchema_ExtensionsEntry = { + encode(message: EnumSchema_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumSchema_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumSchema_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumSchema_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: EnumSchema_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): EnumSchema_ExtensionsEntry { + return EnumSchema_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EnumSchema_ExtensionsEntry { + const message = createBaseEnumSchema_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseJSONSchema(): JSONSchema { + return { + ref: "", + title: "", + description: "", + default: "", + readOnly: false, + example: "", + multipleOf: 0, + maximum: 0, + exclusiveMaximum: false, + minimum: 0, + exclusiveMinimum: false, + maxLength: 0, + minLength: 0, + pattern: "", + maxItems: 0, + minItems: 0, + uniqueItems: false, + maxProperties: 0, + minProperties: 0, + required: [], + array: [], + type: [], + format: "", + enum: [], + fieldConfiguration: undefined, + extensions: {}, + }; +} + +export const JSONSchema = { + encode(message: JSONSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ref !== "") { + writer.uint32(26).string(message.ref); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.description !== "") { + writer.uint32(50).string(message.description); + } + if (message.default !== "") { + writer.uint32(58).string(message.default); + } + if (message.readOnly === true) { + writer.uint32(64).bool(message.readOnly); + } + if (message.example !== "") { + writer.uint32(74).string(message.example); + } + if (message.multipleOf !== 0) { + writer.uint32(81).double(message.multipleOf); + } + if (message.maximum !== 0) { + writer.uint32(89).double(message.maximum); + } + if (message.exclusiveMaximum === true) { + writer.uint32(96).bool(message.exclusiveMaximum); + } + if (message.minimum !== 0) { + writer.uint32(105).double(message.minimum); + } + if (message.exclusiveMinimum === true) { + writer.uint32(112).bool(message.exclusiveMinimum); + } + if (message.maxLength !== 0) { + writer.uint32(120).uint64(message.maxLength); + } + if (message.minLength !== 0) { + writer.uint32(128).uint64(message.minLength); + } + if (message.pattern !== "") { + writer.uint32(138).string(message.pattern); + } + if (message.maxItems !== 0) { + writer.uint32(160).uint64(message.maxItems); + } + if (message.minItems !== 0) { + writer.uint32(168).uint64(message.minItems); + } + if (message.uniqueItems === true) { + writer.uint32(176).bool(message.uniqueItems); + } + if (message.maxProperties !== 0) { + writer.uint32(192).uint64(message.maxProperties); + } + if (message.minProperties !== 0) { + writer.uint32(200).uint64(message.minProperties); + } + for (const v of message.required) { + writer.uint32(210).string(v!); + } + for (const v of message.array) { + writer.uint32(274).string(v!); + } + writer.uint32(282).fork(); + for (const v of message.type) { + writer.int32(v); + } + writer.ldelim(); + if (message.format !== "") { + writer.uint32(290).string(message.format); + } + for (const v of message.enum) { + writer.uint32(370).string(v!); + } + if (message.fieldConfiguration !== undefined) { + JSONSchema_FieldConfiguration.encode(message.fieldConfiguration, writer.uint32(8010).fork()).ldelim(); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + JSONSchema_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(386).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JSONSchema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJSONSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.ref = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.description = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.default = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.readOnly = reader.bool(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.example = reader.string(); + continue; + case 10: + if (tag !== 81) { + break; + } + + message.multipleOf = reader.double(); + continue; + case 11: + if (tag !== 89) { + break; + } + + message.maximum = reader.double(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.exclusiveMaximum = reader.bool(); + continue; + case 13: + if (tag !== 105) { + break; + } + + message.minimum = reader.double(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.exclusiveMinimum = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.maxLength = longToNumber(reader.uint64() as Long); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.minLength = longToNumber(reader.uint64() as Long); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.pattern = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.maxItems = longToNumber(reader.uint64() as Long); + continue; + case 21: + if (tag !== 168) { + break; + } + + message.minItems = longToNumber(reader.uint64() as Long); + continue; + case 22: + if (tag !== 176) { + break; + } + + message.uniqueItems = reader.bool(); + continue; + case 24: + if (tag !== 192) { + break; + } + + message.maxProperties = longToNumber(reader.uint64() as Long); + continue; + case 25: + if (tag !== 200) { + break; + } + + message.minProperties = longToNumber(reader.uint64() as Long); + continue; + case 26: + if (tag !== 210) { + break; + } + + message.required.push(reader.string()); + continue; + case 34: + if (tag !== 274) { + break; + } + + message.array.push(reader.string()); + continue; + case 35: + if (tag === 280) { + message.type.push(reader.int32() as any); + + continue; + } + + if (tag === 282) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.type.push(reader.int32() as any); + } + + continue; + } + + break; + case 36: + if (tag !== 290) { + break; + } + + message.format = reader.string(); + continue; + case 46: + if (tag !== 370) { + break; + } + + message.enum.push(reader.string()); + continue; + case 1001: + if (tag !== 8010) { + break; + } + + message.fieldConfiguration = JSONSchema_FieldConfiguration.decode(reader, reader.uint32()); + continue; + case 48: + if (tag !== 386) { + break; + } + + const entry48 = JSONSchema_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry48.value !== undefined) { + message.extensions[entry48.key] = entry48.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): JSONSchema { + return { + ref: isSet(object.ref) ? String(object.ref) : "", + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + default: isSet(object.default) ? String(object.default) : "", + readOnly: isSet(object.readOnly) ? Boolean(object.readOnly) : false, + example: isSet(object.example) ? String(object.example) : "", + multipleOf: isSet(object.multipleOf) ? Number(object.multipleOf) : 0, + maximum: isSet(object.maximum) ? Number(object.maximum) : 0, + exclusiveMaximum: isSet(object.exclusiveMaximum) ? Boolean(object.exclusiveMaximum) : false, + minimum: isSet(object.minimum) ? Number(object.minimum) : 0, + exclusiveMinimum: isSet(object.exclusiveMinimum) ? Boolean(object.exclusiveMinimum) : false, + maxLength: isSet(object.maxLength) ? Number(object.maxLength) : 0, + minLength: isSet(object.minLength) ? Number(object.minLength) : 0, + pattern: isSet(object.pattern) ? String(object.pattern) : "", + maxItems: isSet(object.maxItems) ? Number(object.maxItems) : 0, + minItems: isSet(object.minItems) ? Number(object.minItems) : 0, + uniqueItems: isSet(object.uniqueItems) ? Boolean(object.uniqueItems) : false, + maxProperties: isSet(object.maxProperties) ? Number(object.maxProperties) : 0, + minProperties: isSet(object.minProperties) ? Number(object.minProperties) : 0, + required: Array.isArray(object?.required) ? object.required.map((e: any) => String(e)) : [], + array: Array.isArray(object?.array) ? object.array.map((e: any) => String(e)) : [], + type: Array.isArray(object?.type) ? object.type.map((e: any) => jSONSchema_JSONSchemaSimpleTypesFromJSON(e)) : [], + format: isSet(object.format) ? String(object.format) : "", + enum: Array.isArray(object?.enum) ? object.enum.map((e: any) => String(e)) : [], + fieldConfiguration: isSet(object.fieldConfiguration) + ? JSONSchema_FieldConfiguration.fromJSON(object.fieldConfiguration) + : undefined, + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: JSONSchema): unknown { + const obj: any = {}; + message.ref !== undefined && (obj.ref = message.ref); + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.default !== undefined && (obj.default = message.default); + message.readOnly !== undefined && (obj.readOnly = message.readOnly); + message.example !== undefined && (obj.example = message.example); + message.multipleOf !== undefined && (obj.multipleOf = message.multipleOf); + message.maximum !== undefined && (obj.maximum = message.maximum); + message.exclusiveMaximum !== undefined && (obj.exclusiveMaximum = message.exclusiveMaximum); + message.minimum !== undefined && (obj.minimum = message.minimum); + message.exclusiveMinimum !== undefined && (obj.exclusiveMinimum = message.exclusiveMinimum); + message.maxLength !== undefined && (obj.maxLength = Math.round(message.maxLength)); + message.minLength !== undefined && (obj.minLength = Math.round(message.minLength)); + message.pattern !== undefined && (obj.pattern = message.pattern); + message.maxItems !== undefined && (obj.maxItems = Math.round(message.maxItems)); + message.minItems !== undefined && (obj.minItems = Math.round(message.minItems)); + message.uniqueItems !== undefined && (obj.uniqueItems = message.uniqueItems); + message.maxProperties !== undefined && (obj.maxProperties = Math.round(message.maxProperties)); + message.minProperties !== undefined && (obj.minProperties = Math.round(message.minProperties)); + if (message.required) { + obj.required = message.required.map((e) => e); + } else { + obj.required = []; + } + if (message.array) { + obj.array = message.array.map((e) => e); + } else { + obj.array = []; + } + if (message.type) { + obj.type = message.type.map((e) => jSONSchema_JSONSchemaSimpleTypesToJSON(e)); + } else { + obj.type = []; + } + message.format !== undefined && (obj.format = message.format); + if (message.enum) { + obj.enum = message.enum.map((e) => e); + } else { + obj.enum = []; + } + message.fieldConfiguration !== undefined && (obj.fieldConfiguration = message.fieldConfiguration + ? JSONSchema_FieldConfiguration.toJSON(message.fieldConfiguration) + : undefined); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): JSONSchema { + return JSONSchema.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): JSONSchema { + const message = createBaseJSONSchema(); + message.ref = object.ref ?? ""; + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.default = object.default ?? ""; + message.readOnly = object.readOnly ?? false; + message.example = object.example ?? ""; + message.multipleOf = object.multipleOf ?? 0; + message.maximum = object.maximum ?? 0; + message.exclusiveMaximum = object.exclusiveMaximum ?? false; + message.minimum = object.minimum ?? 0; + message.exclusiveMinimum = object.exclusiveMinimum ?? false; + message.maxLength = object.maxLength ?? 0; + message.minLength = object.minLength ?? 0; + message.pattern = object.pattern ?? ""; + message.maxItems = object.maxItems ?? 0; + message.minItems = object.minItems ?? 0; + message.uniqueItems = object.uniqueItems ?? false; + message.maxProperties = object.maxProperties ?? 0; + message.minProperties = object.minProperties ?? 0; + message.required = object.required?.map((e) => e) || []; + message.array = object.array?.map((e) => e) || []; + message.type = object.type?.map((e) => e) || []; + message.format = object.format ?? ""; + message.enum = object.enum?.map((e) => e) || []; + message.fieldConfiguration = (object.fieldConfiguration !== undefined && object.fieldConfiguration !== null) + ? JSONSchema_FieldConfiguration.fromPartial(object.fieldConfiguration) + : undefined; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseJSONSchema_FieldConfiguration(): JSONSchema_FieldConfiguration { + return { pathParamName: "" }; +} + +export const JSONSchema_FieldConfiguration = { + encode(message: JSONSchema_FieldConfiguration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pathParamName !== "") { + writer.uint32(378).string(message.pathParamName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JSONSchema_FieldConfiguration { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJSONSchema_FieldConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 47: + if (tag !== 378) { + break; + } + + message.pathParamName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): JSONSchema_FieldConfiguration { + return { pathParamName: isSet(object.pathParamName) ? String(object.pathParamName) : "" }; + }, + + toJSON(message: JSONSchema_FieldConfiguration): unknown { + const obj: any = {}; + message.pathParamName !== undefined && (obj.pathParamName = message.pathParamName); + return obj; + }, + + create, I>>(base?: I): JSONSchema_FieldConfiguration { + return JSONSchema_FieldConfiguration.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): JSONSchema_FieldConfiguration { + const message = createBaseJSONSchema_FieldConfiguration(); + message.pathParamName = object.pathParamName ?? ""; + return message; + }, +}; + +function createBaseJSONSchema_ExtensionsEntry(): JSONSchema_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const JSONSchema_ExtensionsEntry = { + encode(message: JSONSchema_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JSONSchema_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJSONSchema_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): JSONSchema_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: JSONSchema_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): JSONSchema_ExtensionsEntry { + return JSONSchema_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): JSONSchema_ExtensionsEntry { + const message = createBaseJSONSchema_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseTag(): Tag { + return { name: "", description: "", externalDocs: undefined, extensions: {} }; +} + +export const Tag = { + encode(message: Tag, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.externalDocs !== undefined) { + ExternalDocumentation.encode(message.externalDocs, writer.uint32(26).fork()).ldelim(); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + Tag_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Tag { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTag(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.externalDocs = ExternalDocumentation.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + const entry4 = Tag_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.extensions[entry4.key] = entry4.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tag { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + externalDocs: isSet(object.externalDocs) ? ExternalDocumentation.fromJSON(object.externalDocs) : undefined, + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Tag): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + message.externalDocs !== undefined && + (obj.externalDocs = message.externalDocs ? ExternalDocumentation.toJSON(message.externalDocs) : undefined); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): Tag { + return Tag.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Tag { + const message = createBaseTag(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.externalDocs = (object.externalDocs !== undefined && object.externalDocs !== null) + ? ExternalDocumentation.fromPartial(object.externalDocs) + : undefined; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseTag_ExtensionsEntry(): Tag_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const Tag_ExtensionsEntry = { + encode(message: Tag_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Tag_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTag_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tag_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Tag_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Tag_ExtensionsEntry { + return Tag_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Tag_ExtensionsEntry { + const message = createBaseTag_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseSecurityDefinitions(): SecurityDefinitions { + return { security: {} }; +} + +export const SecurityDefinitions = { + encode(message: SecurityDefinitions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.security).forEach(([key, value]) => { + SecurityDefinitions_SecurityEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityDefinitions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityDefinitions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = SecurityDefinitions_SecurityEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.security[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityDefinitions { + return { + security: isObject(object.security) + ? Object.entries(object.security).reduce<{ [key: string]: SecurityScheme }>((acc, [key, value]) => { + acc[key] = SecurityScheme.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: SecurityDefinitions): unknown { + const obj: any = {}; + obj.security = {}; + if (message.security) { + Object.entries(message.security).forEach(([k, v]) => { + obj.security[k] = SecurityScheme.toJSON(v); + }); + } + return obj; + }, + + create, I>>(base?: I): SecurityDefinitions { + return SecurityDefinitions.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): SecurityDefinitions { + const message = createBaseSecurityDefinitions(); + message.security = Object.entries(object.security ?? {}).reduce<{ [key: string]: SecurityScheme }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = SecurityScheme.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseSecurityDefinitions_SecurityEntry(): SecurityDefinitions_SecurityEntry { + return { key: "", value: undefined }; +} + +export const SecurityDefinitions_SecurityEntry = { + encode(message: SecurityDefinitions_SecurityEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + SecurityScheme.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityDefinitions_SecurityEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityDefinitions_SecurityEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = SecurityScheme.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityDefinitions_SecurityEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? SecurityScheme.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: SecurityDefinitions_SecurityEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? SecurityScheme.toJSON(message.value) : undefined); + return obj; + }, + + create, I>>( + base?: I, + ): SecurityDefinitions_SecurityEntry { + return SecurityDefinitions_SecurityEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): SecurityDefinitions_SecurityEntry { + const message = createBaseSecurityDefinitions_SecurityEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? SecurityScheme.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseSecurityScheme(): SecurityScheme { + return { + type: 0, + description: "", + name: "", + in: 0, + flow: 0, + authorizationUrl: "", + tokenUrl: "", + scopes: undefined, + extensions: {}, + }; +} + +export const SecurityScheme = { + encode(message: SecurityScheme, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.in !== 0) { + writer.uint32(32).int32(message.in); + } + if (message.flow !== 0) { + writer.uint32(40).int32(message.flow); + } + if (message.authorizationUrl !== "") { + writer.uint32(50).string(message.authorizationUrl); + } + if (message.tokenUrl !== "") { + writer.uint32(58).string(message.tokenUrl); + } + if (message.scopes !== undefined) { + Scopes.encode(message.scopes, writer.uint32(66).fork()).ldelim(); + } + Object.entries(message.extensions).forEach(([key, value]) => { + if (value !== undefined) { + SecurityScheme_ExtensionsEntry.encode({ key: key as any, value }, writer.uint32(74).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityScheme { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityScheme(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.in = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.flow = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.authorizationUrl = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tokenUrl = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.scopes = Scopes.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + const entry9 = SecurityScheme_ExtensionsEntry.decode(reader, reader.uint32()); + if (entry9.value !== undefined) { + message.extensions[entry9.key] = entry9.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityScheme { + return { + type: isSet(object.type) ? securityScheme_TypeFromJSON(object.type) : 0, + description: isSet(object.description) ? String(object.description) : "", + name: isSet(object.name) ? String(object.name) : "", + in: isSet(object.in) ? securityScheme_InFromJSON(object.in) : 0, + flow: isSet(object.flow) ? securityScheme_FlowFromJSON(object.flow) : 0, + authorizationUrl: isSet(object.authorizationUrl) ? String(object.authorizationUrl) : "", + tokenUrl: isSet(object.tokenUrl) ? String(object.tokenUrl) : "", + scopes: isSet(object.scopes) ? Scopes.fromJSON(object.scopes) : undefined, + extensions: isObject(object.extensions) + ? Object.entries(object.extensions).reduce<{ [key: string]: any }>((acc, [key, value]) => { + acc[key] = value as any; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: SecurityScheme): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = securityScheme_TypeToJSON(message.type)); + message.description !== undefined && (obj.description = message.description); + message.name !== undefined && (obj.name = message.name); + message.in !== undefined && (obj.in = securityScheme_InToJSON(message.in)); + message.flow !== undefined && (obj.flow = securityScheme_FlowToJSON(message.flow)); + message.authorizationUrl !== undefined && (obj.authorizationUrl = message.authorizationUrl); + message.tokenUrl !== undefined && (obj.tokenUrl = message.tokenUrl); + message.scopes !== undefined && (obj.scopes = message.scopes ? Scopes.toJSON(message.scopes) : undefined); + obj.extensions = {}; + if (message.extensions) { + Object.entries(message.extensions).forEach(([k, v]) => { + obj.extensions[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): SecurityScheme { + return SecurityScheme.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): SecurityScheme { + const message = createBaseSecurityScheme(); + message.type = object.type ?? 0; + message.description = object.description ?? ""; + message.name = object.name ?? ""; + message.in = object.in ?? 0; + message.flow = object.flow ?? 0; + message.authorizationUrl = object.authorizationUrl ?? ""; + message.tokenUrl = object.tokenUrl ?? ""; + message.scopes = (object.scopes !== undefined && object.scopes !== null) + ? Scopes.fromPartial(object.scopes) + : undefined; + message.extensions = Object.entries(object.extensions ?? {}).reduce<{ [key: string]: any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseSecurityScheme_ExtensionsEntry(): SecurityScheme_ExtensionsEntry { + return { key: "", value: undefined }; +} + +export const SecurityScheme_ExtensionsEntry = { + encode(message: SecurityScheme_ExtensionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityScheme_ExtensionsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityScheme_ExtensionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityScheme_ExtensionsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: SecurityScheme_ExtensionsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): SecurityScheme_ExtensionsEntry { + return SecurityScheme_ExtensionsEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): SecurityScheme_ExtensionsEntry { + const message = createBaseSecurityScheme_ExtensionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseSecurityRequirement(): SecurityRequirement { + return { securityRequirement: {} }; +} + +export const SecurityRequirement = { + encode(message: SecurityRequirement, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.securityRequirement).forEach(([key, value]) => { + SecurityRequirement_SecurityRequirementEntry.encode({ key: key as any, value }, writer.uint32(10).fork()) + .ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityRequirement { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = SecurityRequirement_SecurityRequirementEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.securityRequirement[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityRequirement { + return { + securityRequirement: isObject(object.securityRequirement) + ? Object.entries(object.securityRequirement).reduce< + { [key: string]: SecurityRequirement_SecurityRequirementValue } + >((acc, [key, value]) => { + acc[key] = SecurityRequirement_SecurityRequirementValue.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: SecurityRequirement): unknown { + const obj: any = {}; + obj.securityRequirement = {}; + if (message.securityRequirement) { + Object.entries(message.securityRequirement).forEach(([k, v]) => { + obj.securityRequirement[k] = SecurityRequirement_SecurityRequirementValue.toJSON(v); + }); + } + return obj; + }, + + create, I>>(base?: I): SecurityRequirement { + return SecurityRequirement.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): SecurityRequirement { + const message = createBaseSecurityRequirement(); + message.securityRequirement = Object.entries(object.securityRequirement ?? {}).reduce< + { [key: string]: SecurityRequirement_SecurityRequirementValue } + >((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = SecurityRequirement_SecurityRequirementValue.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseSecurityRequirement_SecurityRequirementValue(): SecurityRequirement_SecurityRequirementValue { + return { scope: [] }; +} + +export const SecurityRequirement_SecurityRequirementValue = { + encode(message: SecurityRequirement_SecurityRequirementValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.scope) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityRequirement_SecurityRequirementValue { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityRequirement_SecurityRequirementValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.scope.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityRequirement_SecurityRequirementValue { + return { scope: Array.isArray(object?.scope) ? object.scope.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: SecurityRequirement_SecurityRequirementValue): unknown { + const obj: any = {}; + if (message.scope) { + obj.scope = message.scope.map((e) => e); + } else { + obj.scope = []; + } + return obj; + }, + + create, I>>( + base?: I, + ): SecurityRequirement_SecurityRequirementValue { + return SecurityRequirement_SecurityRequirementValue.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): SecurityRequirement_SecurityRequirementValue { + const message = createBaseSecurityRequirement_SecurityRequirementValue(); + message.scope = object.scope?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSecurityRequirement_SecurityRequirementEntry(): SecurityRequirement_SecurityRequirementEntry { + return { key: "", value: undefined }; +} + +export const SecurityRequirement_SecurityRequirementEntry = { + encode(message: SecurityRequirement_SecurityRequirementEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + SecurityRequirement_SecurityRequirementValue.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecurityRequirement_SecurityRequirementEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityRequirement_SecurityRequirementEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = SecurityRequirement_SecurityRequirementValue.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecurityRequirement_SecurityRequirementEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? SecurityRequirement_SecurityRequirementValue.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: SecurityRequirement_SecurityRequirementEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && + (obj.value = message.value ? SecurityRequirement_SecurityRequirementValue.toJSON(message.value) : undefined); + return obj; + }, + + create, I>>( + base?: I, + ): SecurityRequirement_SecurityRequirementEntry { + return SecurityRequirement_SecurityRequirementEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): SecurityRequirement_SecurityRequirementEntry { + const message = createBaseSecurityRequirement_SecurityRequirementEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? SecurityRequirement_SecurityRequirementValue.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseScopes(): Scopes { + return { scope: {} }; +} + +export const Scopes = { + encode(message: Scopes, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.scope).forEach(([key, value]) => { + Scopes_ScopeEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Scopes { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScopes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = Scopes_ScopeEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.scope[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Scopes { + return { + scope: isObject(object.scope) + ? Object.entries(object.scope).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Scopes): unknown { + const obj: any = {}; + obj.scope = {}; + if (message.scope) { + Object.entries(message.scope).forEach(([k, v]) => { + obj.scope[k] = v; + }); + } + return obj; + }, + + create, I>>(base?: I): Scopes { + return Scopes.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Scopes { + const message = createBaseScopes(); + message.scope = Object.entries(object.scope ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = String(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseScopes_ScopeEntry(): Scopes_ScopeEntry { + return { key: "", value: "" }; +} + +export const Scopes_ScopeEntry = { + encode(message: Scopes_ScopeEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Scopes_ScopeEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScopes_ScopeEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Scopes_ScopeEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: Scopes_ScopeEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): Scopes_ScopeEntry { + return Scopes_ScopeEntry.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Scopes_ScopeEntry { + const message = createBaseScopes_ScopeEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.jsonschema.json index 0585ec000..46b133e7f 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.jsonschema.json @@ -2,13 +2,15 @@ "$id": "controlplane.v1.DiscoverPublicSharedRequest.jsonschema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "DiscoverPublicSharedRequest is the request for the DiscoverPublicShared method", "properties": { "digest": { + "description": "Digest is the unique identifier of the referrer to discover", "minLength": 1, "type": "string" }, "kind": { - "description": "Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", + "description": "Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", "type": "string" } }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.schema.json index 50477f515..675b824de 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedRequest.schema.json @@ -2,13 +2,15 @@ "$id": "controlplane.v1.DiscoverPublicSharedRequest.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "DiscoverPublicSharedRequest is the request for the DiscoverPublicShared method", "properties": { "digest": { + "description": "Digest is the unique identifier of the referrer to discover", "minLength": 1, "type": "string" }, "kind": { - "description": "Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", + "description": "Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", "type": "string" } }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.jsonschema.json index a185eb43a..f5fd80ff1 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.jsonschema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.DiscoverPublicSharedResponse.jsonschema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "DiscoverPublicSharedResponse is the response for the DiscoverPublicShared method", "properties": { "result": { - "$ref": "controlplane.v1.ReferrerItem.jsonschema.json" + "$ref": "controlplane.v1.ReferrerItem.jsonschema.json", + "description": "Result is the discovered referrer item" } }, "title": "Discover Public Shared Response", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.schema.json index 8a5a9c54d..bee5d51af 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DiscoverPublicSharedResponse.schema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.DiscoverPublicSharedResponse.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "DiscoverPublicSharedResponse is the response for the DiscoverPublicShared method", "properties": { "result": { - "$ref": "controlplane.v1.ReferrerItem.schema.json" + "$ref": "controlplane.v1.ReferrerItem.schema.json", + "description": "Result is the discovered referrer item" } }, "title": "Discover Public Shared Response", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.jsonschema.json new file mode 100644 index 000000000..2b3e1b8d3 --- /dev/null +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.jsonschema.json @@ -0,0 +1,13 @@ +{ + "$id": "controlplane.v1.DownloadRequest.jsonschema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": false, + "properties": { + "digest": { + "minLength": 1, + "type": "string" + } + }, + "title": "Download Request", + "type": "object" +} diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.schema.json new file mode 100644 index 000000000..5105e2476 --- /dev/null +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadRequest.schema.json @@ -0,0 +1,13 @@ +{ + "$id": "controlplane.v1.DownloadRequest.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": false, + "properties": { + "digest": { + "minLength": 1, + "type": "string" + } + }, + "title": "Download Request", + "type": "object" +} diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.jsonschema.json new file mode 100644 index 000000000..00e564314 --- /dev/null +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.jsonschema.json @@ -0,0 +1,8 @@ +{ + "$id": "controlplane.v1.DownloadResponse.jsonschema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": false, + "properties": {}, + "title": "Download Response", + "type": "object" +} diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.schema.json new file mode 100644 index 000000000..17897331b --- /dev/null +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.DownloadResponse.schema.json @@ -0,0 +1,8 @@ +{ + "$id": "controlplane.v1.DownloadResponse.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": false, + "properties": {}, + "title": "Download Response", + "type": "object" +} diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.jsonschema.json index 3607fb815..41416b12f 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.jsonschema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.ReferrerItem.jsonschema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerItem represents a referrer object in the system", "patternProperties": { "^(created_at)$": { - "$ref": "google.protobuf.Timestamp.jsonschema.json" + "$ref": "google.protobuf.Timestamp.jsonschema.json", + "description": "CreatedAt is the timestamp when the referrer was created" } }, "properties": { @@ -12,20 +14,22 @@ "additionalProperties": { "type": "string" }, + "description": "Annotations are key-value pairs associated with the referrer", "propertyNames": { "type": "string" }, "type": "object" }, "createdAt": { - "$ref": "google.protobuf.Timestamp.jsonschema.json" + "$ref": "google.protobuf.Timestamp.jsonschema.json", + "description": "CreatedAt is the timestamp when the referrer was created" }, "digest": { "description": "Digest of the referrer, i.e sha256:deadbeef or sha1:beefdead", "type": "string" }, "downloadable": { - "description": "Whether the referrer is downloadable or not from CAS", + "description": "Downloadable indicates whether the referrer is downloadable or not from CAS", "type": "boolean" }, "kind": { @@ -36,16 +40,18 @@ "additionalProperties": { "type": "string" }, + "description": "Metadata contains additional descriptive information about the referrer", "propertyNames": { "type": "string" }, "type": "object" }, "public": { - "description": "Whether the referrer is public since it belongs to a public workflow", + "description": "Public indicates whether the referrer is public since it belongs to a public workflow", "type": "boolean" }, "references": { + "description": "References contains the list of related referrer items", "items": { "$ref": "controlplane.v1.ReferrerItem.jsonschema.json" }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.schema.json index fdd16575a..1d6242f66 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerItem.schema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.ReferrerItem.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerItem represents a referrer object in the system", "patternProperties": { "^(createdAt)$": { - "$ref": "google.protobuf.Timestamp.schema.json" + "$ref": "google.protobuf.Timestamp.schema.json", + "description": "CreatedAt is the timestamp when the referrer was created" } }, "properties": { @@ -12,20 +14,22 @@ "additionalProperties": { "type": "string" }, + "description": "Annotations are key-value pairs associated with the referrer", "propertyNames": { "type": "string" }, "type": "object" }, "created_at": { - "$ref": "google.protobuf.Timestamp.schema.json" + "$ref": "google.protobuf.Timestamp.schema.json", + "description": "CreatedAt is the timestamp when the referrer was created" }, "digest": { "description": "Digest of the referrer, i.e sha256:deadbeef or sha1:beefdead", "type": "string" }, "downloadable": { - "description": "Whether the referrer is downloadable or not from CAS", + "description": "Downloadable indicates whether the referrer is downloadable or not from CAS", "type": "boolean" }, "kind": { @@ -36,16 +40,18 @@ "additionalProperties": { "type": "string" }, + "description": "Metadata contains additional descriptive information about the referrer", "propertyNames": { "type": "string" }, "type": "object" }, "public": { - "description": "Whether the referrer is public since it belongs to a public workflow", + "description": "Public indicates whether the referrer is public since it belongs to a public workflow", "type": "boolean" }, "references": { + "description": "References contains the list of related referrer items", "items": { "$ref": "controlplane.v1.ReferrerItem.schema.json" }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.jsonschema.json index 3ff6822fb..dee59c0db 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.jsonschema.json @@ -2,13 +2,15 @@ "$id": "controlplane.v1.ReferrerServiceDiscoverPrivateRequest.jsonschema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerServiceDiscoverPrivateRequest is the request for the DiscoverPrivate method", "properties": { "digest": { + "description": "Digest is the unique identifier of the referrer to discover", "minLength": 1, "type": "string" }, "kind": { - "description": "Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", + "description": "Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", "type": "string" } }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.schema.json index 11382d1c0..0fbb61a8e 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateRequest.schema.json @@ -2,13 +2,15 @@ "$id": "controlplane.v1.ReferrerServiceDiscoverPrivateRequest.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerServiceDiscoverPrivateRequest is the request for the DiscoverPrivate method", "properties": { "digest": { + "description": "Digest is the unique identifier of the referrer to discover", "minLength": 1, "type": "string" }, "kind": { - "description": "Optional kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", + "description": "Kind is the optional type of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ...\n Used to filter and resolve ambiguities", "type": "string" } }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.jsonschema.json index 8f1098cbc..7e319fc37 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.jsonschema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.ReferrerServiceDiscoverPrivateResponse.jsonschema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerServiceDiscoverPrivateResponse is the response for the DiscoverPrivate method", "properties": { "result": { - "$ref": "controlplane.v1.ReferrerItem.jsonschema.json" + "$ref": "controlplane.v1.ReferrerItem.jsonschema.json", + "description": "Result is the discovered referrer item" } }, "title": "Referrer Service Discover Private Response", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.schema.json index 571e62898..7d70255ca 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.ReferrerServiceDiscoverPrivateResponse.schema.json @@ -2,9 +2,11 @@ "$id": "controlplane.v1.ReferrerServiceDiscoverPrivateResponse.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, + "description": "ReferrerServiceDiscoverPrivateResponse is the response for the DiscoverPrivate method", "properties": { "result": { - "$ref": "controlplane.v1.ReferrerItem.schema.json" + "$ref": "controlplane.v1.ReferrerItem.schema.json", + "description": "Result is the discovered referrer item" } }, "title": "Referrer Service Discover Private Response", diff --git a/app/controlplane/api/gen/openapi/openapi-extra.yaml b/app/controlplane/api/gen/openapi/openapi-extra.yaml new file mode 100644 index 000000000..c0239d7d4 --- /dev/null +++ b/app/controlplane/api/gen/openapi/openapi-extra.yaml @@ -0,0 +1,90 @@ +# This file is meant to document endpoints that cannot be generated automatically from the GRPc service definitions. +# And to include additional metadata for the OpenAPI specification if needed and required. +# This file will be automatically merged with the OpenAPI specification generated from the GRPC service definitions. +openapi: 3.0.3 +info: + title: Chainloop Controlplane API + version: '1.0' + +paths: + /download/{digest}: + get: + summary: Download Artifacts from CAS + description: | + Downloads artifacts stored in the Chainloop Content Addressable Storage (CAS). + + The artifact is identified by its cryptographic digest, which serves as both the unique + identifier and integrity verification mechanism. The endpoint behavior varies based on + the client type detected via the Accept header. + + **Client-Specific Behavior:** + - **Browser clients** (Accept contains "text/html"): Receives a user-friendly message with + a 1-second delayed redirect using the Refresh header + - **CLI/API clients** (other Accept values): Receives immediate 302 redirect via Location header + parameters: + - name: digest + in: path + required: true + description: | + The full cryptographic digest of the artifact including algorithm prefix. + Currently supports SHA-256 hashes only. + schema: + type: string + pattern: '^sha256:[a-f0-9]{64}$' + minLength: 71 + maxLength: 71 + example: "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + - name: Accept + in: header + required: false + description: | + Content type preferences. Affects redirect behavior: + - Contains "text/html": Browser-friendly redirect with delay and message + - Other values: Direct 302 redirect (suitable for CLI tools like curl) + schema: + type: string + example: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" + responses: + '302': + description: | + Successful redirect to artifact download URL. + Response behavior depends on the Accept header: + + **For browsers** (Accept contains "text/html"): + - Uses `Refresh` header with 1-second delay + - Returns user-friendly message in response body + - Provides better UX for browser downloads + + **For CLI tools** (other Accept values): + - Uses standard `Location` header for immediate redirect + - Empty response body + - Suitable for automated tools like curl + headers: + Location: + description: | + Pre-signed download URL for the artifact. + Present when client is NOT a browser (no "text/html" in Accept header). + schema: + type: string + format: uri + example: "https://api.cp.chainloop.dev/artifacts/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855?token=..." + Refresh: + description: | + Browser redirect with delay and URL. + Present when client IS a browser ("text/html" in Accept header). + Format: "delay_seconds;url=redirect_url" + schema: + type: string + example: "1;url=https://api.cp.chainloop.dev/artifacts/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855?token=..." + content: + text/plain: + schema: + type: string + example: "Your download will begin shortly..." + tags: + - DownloadService + security: + - bearerToken: [] +tags: + - name: DownloadService + description: Operations for downloading and managing artifacts from the Content Addressable Storage \ No newline at end of file diff --git a/app/controlplane/api/gen/openapi/openapi.yaml b/app/controlplane/api/gen/openapi/openapi.yaml new file mode 100644 index 000000000..7e5103467 --- /dev/null +++ b/app/controlplane/api/gen/openapi/openapi.yaml @@ -0,0 +1,333 @@ +openapi: 3.0.1 +info: + contact: + email: support@chainloop.dev + name: Chainloop Support + url: https://chainloop.dev + termsOfService: https://chainloop.dev/terms + title: Chainloop Controlplane API + version: '1.0' +servers: + - url: https://cp.chainloop.dev/ +tags: + - description: Referrer service for discovering referred content by digest + name: ReferrerService + x-displayName: ReferrerService + - name: DownloadService + description: >- + Operations for downloading and managing artifacts from the Content + Addressable Storage + x-displayName: DownloadService +externalDocs: + description: Chainloop Official Documentation + url: https://docs.chainloop.dev +paths: + /discover/shared/{digest}: + get: + description: Returns the referrer item for a given digest in the public shared index + operationId: ReferrerService_DiscoverPublicShared + parameters: + - description: Digest is the unique identifier of the referrer to discover + in: path + name: digest + required: true + schema: + type: string + - description: >- + Kind is the optional type of referrer, i.e CONTAINER_IMAGE, + GIT_HEAD, ... + + Used to filter and resolve ambiguities + in: query + name: kind + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/v1DiscoverPublicSharedResponse' + description: A successful response. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/rpcStatus' + description: An unexpected error response. + summary: Discover public shared referrer + tags: + - ReferrerService + security: + - bearerToken: [] + /discover/{digest}: + get: + description: >- + Returns the referrer item for a given digest in the organizations of the + logged-in user + operationId: ReferrerService_DiscoverPrivate + parameters: + - description: Digest is the unique identifier of the referrer to discover + in: path + name: digest + required: true + schema: + type: string + - description: >- + Kind is the optional type of referrer, i.e CONTAINER_IMAGE, + GIT_HEAD, ... + + Used to filter and resolve ambiguities + in: query + name: kind + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/v1ReferrerServiceDiscoverPrivateResponse' + description: A successful response. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/rpcStatus' + description: An unexpected error response. + summary: Discover private referrer + tags: + - ReferrerService + security: + - bearerToken: [] + /download/{digest}: + get: + summary: Download Artifacts from CAS + description: > + Downloads artifacts stored in the Chainloop Content Addressable Storage + (CAS). + + + The artifact is identified by its cryptographic digest, which serves as + both the unique + + identifier and integrity verification mechanism. The endpoint behavior + varies based on + + the client type detected via the Accept header. + + + **Client-Specific Behavior:** + + - **Browser clients** (Accept contains "text/html"): Receives a + user-friendly message with + a 1-second delayed redirect using the Refresh header + - **CLI/API clients** (other Accept values): Receives immediate 302 + redirect via Location header + parameters: + - name: digest + in: path + required: true + description: > + The full cryptographic digest of the artifact including algorithm + prefix. + + Currently supports SHA-256 hashes only. + schema: + type: string + pattern: ^sha256:[a-f0-9]{64}$ + minLength: 71 + maxLength: 71 + example: >- + sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + - name: Accept + in: header + required: false + description: > + Content type preferences. Affects redirect behavior: + + - Contains "text/html": Browser-friendly redirect with delay and + message + + - Other values: Direct 302 redirect (suitable for CLI tools like + curl) + schema: + type: string + example: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 + responses: + '302': + description: | + Successful redirect to artifact download URL. + Response behavior depends on the Accept header: + + **For browsers** (Accept contains "text/html"): + - Uses `Refresh` header with 1-second delay + - Returns user-friendly message in response body + - Provides better UX for browser downloads + + **For CLI tools** (other Accept values): + - Uses standard `Location` header for immediate redirect + - Empty response body + - Suitable for automated tools like curl + headers: + Location: + description: > + Pre-signed download URL for the artifact. + + Present when client is NOT a browser (no "text/html" in Accept + header). + schema: + type: string + format: uri + example: >- + https://api.cp.chainloop.dev/artifacts/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855?token=... + Refresh: + description: | + Browser redirect with delay and URL. + Present when client IS a browser ("text/html" in Accept header). + Format: "delay_seconds;url=redirect_url" + schema: + type: string + example: >- + 1;url=https://api.cp.chainloop.dev/artifacts/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855?token=... + content: + text/plain: + schema: + type: string + example: Your download will begin shortly... + tags: + - DownloadService + security: + - bearerToken: [] +components: + schemas: + protobufAny: + additionalProperties: + type: object + example: + '@type': '@type' + properties: + '@type': + type: string + type: object + rpcStatus: + example: + code: 0 + details: + - '@type': '@type' + - '@type': '@type' + message: message + properties: + code: + format: int32 + type: integer + message: + type: string + details: + items: + $ref: '#/components/schemas/protobufAny' + type: array + type: object + v1DiscoverPublicSharedResponse: + description: Response for the DiscoverPublicShared method + example: + result: + downloadable: true + metadata: + key: metadata + public: true + references: + - null + - null + kind: kind + digest: digest + created_at: '2000-01-23T04:56:07.000+00:00' + annotations: + key: annotations + properties: + result: + $ref: '#/components/schemas/v1ReferrerItem' + title: DiscoverPublicSharedResponse + type: object + v1ReferrerItem: + description: It represents a referrer object in the system + example: + downloadable: true + metadata: + key: metadata + public: true + references: + - null + - null + kind: kind + digest: digest + created_at: '2000-01-23T04:56:07.000+00:00' + annotations: + key: annotations + properties: + digest: + title: Digest of the referrer, i.e sha256:deadbeef or sha1:beefdead + type: string + kind: + description: Kind of referrer, i.e CONTAINER_IMAGE, GIT_HEAD, ... + type: string + downloadable: + title: >- + Downloadable indicates whether the referrer is downloadable or not + from CAS + type: boolean + public: + title: >- + Public indicates whether the referrer is public since it belongs to + a public workflow + type: boolean + references: + items: + $ref: '#/components/schemas/v1ReferrerItem' + title: References contains the list of related referrer items + type: array + created_at: + format: date-time + title: CreatedAt is the timestamp when the referrer was created + type: string + metadata: + additionalProperties: + type: string + title: >- + Metadata contains additional descriptive information about the + referrer + type: object + annotations: + additionalProperties: + type: string + title: Annotations are key-value pairs associated with the referrer + type: object + title: ReferrerItem + type: object + v1ReferrerServiceDiscoverPrivateResponse: + description: Response for the DiscoverPrivate method + example: + result: + downloadable: true + metadata: + key: metadata + public: true + references: + - null + - null + kind: kind + digest: digest + created_at: '2000-01-23T04:56:07.000+00:00' + annotations: + key: annotations + properties: + result: + $ref: '#/components/schemas/v1ReferrerItem' + title: ReferrerServiceDiscoverPrivateResponse + type: object + securitySchemes: + bearerToken: + description: Bearer token for authentication + type: http + scheme: bearer + bearerFormat: JWT diff --git a/app/controlplane/internal/conf/buf.lock b/app/controlplane/internal/conf/buf.lock index a55648428..612343998 100644 --- a/app/controlplane/internal/conf/buf.lock +++ b/app/controlplane/internal/conf/buf.lock @@ -5,10 +5,12 @@ deps: owner: bufbuild repository: protovalidate commit: 46a4cf4ba1094a34bcd89a6c67163b4b + digest: shake256:436ce453801917c11bc7b21d66bcfae87da2aceb804a041487be1e51dc9fbc219e61ea6a552db7a7aa6d63bb5efd0f3ed5fe3d4c42d4f750d0eb35f14144e3b6 - remote: buf.build owner: googleapis repository: googleapis commit: f0e53af8f2fc4556b94f482688b57223 + digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95 - remote: buf.build owner: kratos-go repository: kratos diff --git a/app/controlplane/internal/conf/buf.yaml b/app/controlplane/internal/conf/buf.yaml index c98a57a3d..e1a1c3605 100644 --- a/app/controlplane/internal/conf/buf.yaml +++ b/app/controlplane/internal/conf/buf.yaml @@ -3,9 +3,9 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate - - buf.build/kratos-go/kratos + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 + - buf.build/kratos-go/kratos:e1d52e944e3845c6862a566db322432d lint: use: - DEFAULT diff --git a/app/controlplane/pkg/conf/buf.lock b/app/controlplane/pkg/conf/buf.lock index a55648428..612343998 100644 --- a/app/controlplane/pkg/conf/buf.lock +++ b/app/controlplane/pkg/conf/buf.lock @@ -5,10 +5,12 @@ deps: owner: bufbuild repository: protovalidate commit: 46a4cf4ba1094a34bcd89a6c67163b4b + digest: shake256:436ce453801917c11bc7b21d66bcfae87da2aceb804a041487be1e51dc9fbc219e61ea6a552db7a7aa6d63bb5efd0f3ed5fe3d4c42d4f750d0eb35f14144e3b6 - remote: buf.build owner: googleapis repository: googleapis commit: f0e53af8f2fc4556b94f482688b57223 + digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95 - remote: buf.build owner: kratos-go repository: kratos diff --git a/app/controlplane/pkg/conf/buf.yaml b/app/controlplane/pkg/conf/buf.yaml index 65919fd53..fe7089ac2 100644 --- a/app/controlplane/pkg/conf/buf.yaml +++ b/app/controlplane/pkg/conf/buf.yaml @@ -3,8 +3,8 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 lint: use: - DEFAULT diff --git a/app/controlplane/pkg/conf/controlplane/config/v1/config.proto b/app/controlplane/pkg/conf/controlplane/config/v1/config.proto index 65e793534..785586d5e 100644 --- a/app/controlplane/pkg/conf/controlplane/config/v1/config.proto +++ b/app/controlplane/pkg/conf/controlplane/config/v1/config.proto @@ -55,4 +55,4 @@ message DatabaseConfig { int32 min_open_conns = 3; int32 max_open_conns = 4; google.protobuf.Duration max_conn_idle_time = 5; -} \ No newline at end of file +} diff --git a/app/controlplane/scripts/modify-openapi-schema.sh b/app/controlplane/scripts/modify-openapi-schema.sh new file mode 100755 index 000000000..8b002f148 --- /dev/null +++ b/app/controlplane/scripts/modify-openapi-schema.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Usage: ./modify-openapi-schema.sh [] +# Example: ./modify-openapi-schema.sh ./gen temp-openapi/apidocs.swagger.json openapi/openapi/openapi.yaml openapi/base-openapi.yaml + +if [ $# -lt 3 ] || [ $# -gt 4 ]; then + echo "Usage: $0 []" + exit 1 +fi + +HOST_MOUNT_DIR="$1" +INPUT_SWAGGER_JSON="$2" +OUTPUT_OPENAPI_YAML="$3" +BASE_OPENAPI_YAML="${4:-}" # Optional 4th parameter for base document + +# Check for required tools and Docker daemon +if ! command -v yq >/dev/null 2>&1; then + echo "yq is not installed. Please install yq by running 'make init'" >&2 + exit 2 +elif ! command -v docker >/dev/null 2>&1; then + echo "Docker is not installed or not in PATH." >&2 + exit 2 +elif ! docker info >/dev/null 2>&1; then + echo "Docker is not running or you do not have permission to access the Docker daemon." >&2 + exit 2 +fi + +# Modify the security scheme in the generated OpenAPI YAML +modify_security_scheme() { + local openapi_file="$1" + yq -i ' + .components.securitySchemes.bearerToken.type = "http" | + .components.securitySchemes.bearerToken.scheme = "bearer" | + .components.securitySchemes.bearerToken.bearerFormat = "JWT" | + del(.components.securitySchemes.bearerToken.name) | + del(.components.securitySchemes.bearerToken.in) + ' "$openapi_file" +} + +# Clean up temporary files and directories +cleanup() { + local host_mount_dir="$1" + + # Clean up temp directory inside the mounted host directory + rm -rf "$host_mount_dir/temp-openapi" + + # Clean up the generated OpenAPI supporting files + rm -rf "$host_mount_dir/openapi/.openapi-generator" "$host_mount_dir/openapi/.openapi-generator-ignore" "$host_mount_dir/openapi/README.md" + + # Move up the generated OpenAPI YAML file + cp "$host_mount_dir/openapi/openapi/openapi.yaml" "$host_mount_dir/openapi/" + + # Remove the now-empty directory + rm -rf "$host_mount_dir/openapi/openapi" +} + +# Run OpenAPI Generator CLI via Docker, mounting the specified host directory +docker run --rm --user "$(id -u)":"$(id -g)" \ + -v "$(realpath "$HOST_MOUNT_DIR"):/local" \ + openapitools/openapi-generator-cli@sha256:a711d89180b9ce34348413a830b21e9c4d3bdf325a154659211cd7a737b0f95a generate \ + -i "/local/$INPUT_SWAGGER_JSON" \ + -g openapi-yaml \ + -o "/local/openapi" + +modify_security_scheme "$HOST_MOUNT_DIR/$OUTPUT_OPENAPI_YAML" + +# Merge with base document if provided, otherwise merge with openapi-extra.yaml +if [ -n "$BASE_OPENAPI_YAML" ]; then + echo "Merging with base document: $BASE_OPENAPI_YAML" + + # Check if the base document exists + if [ ! -f "$HOST_MOUNT_DIR/$BASE_OPENAPI_YAML" ]; then + echo "Base OpenAPI file not found: $HOST_MOUNT_DIR/$BASE_OPENAPI_YAML" >&2 + exit 3 + fi + + echo "Base document exists at: $HOST_MOUNT_DIR/$BASE_OPENAPI_YAML" + + # Run Redocly CLI to join the specs + docker run --rm -v "$(realpath "$HOST_MOUNT_DIR"):/spec" \ + redocly/cli@sha256:a2e50da1c3807122c9d2e0d2a83e11ddc1c60b676b50d08b02c5dde8506f3eee join \ + "/spec/$OUTPUT_OPENAPI_YAML" \ + "/spec/$BASE_OPENAPI_YAML" \ + -o "/spec/$OUTPUT_OPENAPI_YAML" \ + --without-x-tag-groups + + if [ $? -ne 0 ]; then + echo "Failed to merge OpenAPI specifications" >&2 + exit 4 + fi + + echo "Successfully merged OpenAPI specifications" +fi + +cleanup "$HOST_MOUNT_DIR" + diff --git a/common.mk b/common.mk index 09ab4e3d7..779814809 100644 --- a/common.mk +++ b/common.mk @@ -14,8 +14,10 @@ init: init-api-tools init-api-tools: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 - go install github.com/bufbuild/buf/cmd/buf@v1.40.1 + go install github.com/bufbuild/buf/cmd/buf@v1.49.0 go install github.com/envoyproxy/protoc-gen-validate@v1.0.1 + go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.26.3 + go install github.com/mikefarah/yq/v4@v4.45.1 # Tools fixed to a specific version via its commit since they are not released standalone go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@v2.0.0-20231102162905-3fc8fb7a0a0b go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@v2.0.0-20231102162905-3fc8fb7a0a0b diff --git a/go.mod b/go.mod index a7277a530..76d77c3ca 100644 --- a/go.mod +++ b/go.mod @@ -74,6 +74,7 @@ require ( github.com/denisbrodbeck/machineid v1.0.1 github.com/google/go-github/v66 v66.0.0 github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/in-toto/attestation v1.1.0 github.com/invopop/jsonschema v0.7.0 @@ -155,7 +156,6 @@ require ( github.com/google/go-github/v55 v55.0.0 // indirect github.com/google/renameio/v2 v2.0.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/yamux v0.1.2 // indirect diff --git a/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto b/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto index addfe3de3..8cc4b86e3 100644 --- a/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto +++ b/pkg/attestation/crafter/api/attestation/v1/crafting_state.proto @@ -163,7 +163,7 @@ message Attestation { // The runner environment in which the attestation was crafted message RunnerEnvironment { - // Workflow file path that was used during build + // Workflow file path that was used during build string workflow_file_path = 1; // Runner environment name, i.e. github-hosted diff --git a/pkg/attestation/crafter/api/buf.lock b/pkg/attestation/crafter/api/buf.lock index f1d8f9aa8..25a4677ba 100644 --- a/pkg/attestation/crafter/api/buf.lock +++ b/pkg/attestation/crafter/api/buf.lock @@ -5,7 +5,9 @@ deps: owner: bufbuild repository: protovalidate commit: b983156c5e994cc9892e0ce3e64e17e0 + digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2 - remote: buf.build owner: googleapis repository: googleapis commit: 7a6bc1e3207144b38e9066861e1de0ff + digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95 diff --git a/pkg/attestation/crafter/api/buf.yaml b/pkg/attestation/crafter/api/buf.yaml index 65919fd53..fe7089ac2 100644 --- a/pkg/attestation/crafter/api/buf.yaml +++ b/pkg/attestation/crafter/api/buf.yaml @@ -3,8 +3,8 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 lint: use: - DEFAULT diff --git a/pkg/credentials/api/buf.lock b/pkg/credentials/api/buf.lock index f1d8f9aa8..0620a5988 100644 --- a/pkg/credentials/api/buf.lock +++ b/pkg/credentials/api/buf.lock @@ -5,7 +5,9 @@ deps: owner: bufbuild repository: protovalidate commit: b983156c5e994cc9892e0ce3e64e17e0 + digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2 - remote: buf.build owner: googleapis repository: googleapis - commit: 7a6bc1e3207144b38e9066861e1de0ff + commit: 4ed3bc159a8b4ac68fe253218760d035 + digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13 diff --git a/pkg/credentials/api/buf.yaml b/pkg/credentials/api/buf.yaml index 248033ffe..2953bde9b 100644 --- a/pkg/credentials/api/buf.yaml +++ b/pkg/credentials/api/buf.yaml @@ -3,8 +3,8 @@ breaking: use: - FILE deps: - - buf.build/googleapis/googleapis - - buf.build/bufbuild/protovalidate + - buf.build/googleapis/googleapis:4ed3bc159a8b4ac68fe253218760d035 + - buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0 lint: use: - DEFAULT \ No newline at end of file