From d4a009e751ea3234c0e9a9a5817923b21654eaa8 Mon Sep 17 00:00:00 2001 From: George MacRorie Date: Fri, 24 Mar 2023 12:32:01 +0000 Subject: [PATCH] fix: generate protobuf without openapi annotations --- .ruby-version | 2 +- buf.gen.yaml | 4 ++-- flipt-grpc-ruby.gemspec | 4 ++-- lib/auth/auth_pb.rb | 13 +++++++++++-- lib/auth/auth_services_pb.rb | 14 ++++++++++++++ lib/flipt_pb.rb | 1 - lib/meta/meta_pb.rb | 1 - 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.ruby-version b/.ruby-version index 097a15a..1f7da99 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.2 +2.7.7 diff --git a/buf.gen.yaml b/buf.gen.yaml index c9b92f7..49cffe7 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,6 +1,6 @@ version: v1 plugins: - - remote: buf.build/protocolbuffers/plugins/ruby:v3.19.1-1 + - remote: buf.build/protocolbuffers/plugins/ruby:v21.10.0-1 out: ./lib - - remote: buf.build/grpc/plugins/ruby:v1.41.1-1 + - remote: buf.build/grpc/plugins/ruby:v1.51.1-1 out: ./lib diff --git a/flipt-grpc-ruby.gemspec b/flipt-grpc-ruby.gemspec index e378bcd..ce5580a 100644 --- a/flipt-grpc-ruby.gemspec +++ b/flipt-grpc-ruby.gemspec @@ -34,8 +34,8 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] - spec.add_dependency "grpc", "~> 1.0" + spec.add_dependency "grpc", "~> 1.53.0" - spec.add_development_dependency "bundler", "~> 1.17" + spec.add_development_dependency "bundler", "~> 2" spec.add_development_dependency "rake", "~> 13.0" end diff --git a/lib/auth/auth_pb.rb b/lib/auth/auth_pb.rb index 21ec4d7..5fe1cf2 100644 --- a/lib/auth/auth_pb.rb +++ b/lib/auth/auth_pb.rb @@ -4,9 +4,8 @@ require 'google/protobuf' require 'google/protobuf/empty_pb' -require 'google/protobuf/timestamp_pb' require 'google/protobuf/struct_pb' -require 'protoc-gen-openapiv2/options/annotations_pb' +require 'google/protobuf/timestamp_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("auth/auth.proto", :syntax => :proto3) do @@ -70,10 +69,18 @@ optional :client_token, :string, 1, json_name: "clientToken" optional :authentication, :message, 2, "flipt.auth.Authentication", json_name: "authentication" end + add_message "flipt.auth.VerifyServiceAccountRequest" do + optional :service_account_token, :string, 1, json_name: "serviceAccountToken" + end + add_message "flipt.auth.VerifyServiceAccountResponse" do + optional :client_token, :string, 1, json_name: "clientToken" + optional :authentication, :message, 2, "flipt.auth.Authentication", json_name: "authentication" + end add_enum "flipt.auth.Method" do value :METHOD_NONE, 0 value :METHOD_TOKEN, 1 value :METHOD_OIDC, 2 + value :METHOD_KUBERNETES, 3 end end end @@ -94,6 +101,8 @@ module Auth AuthorizeURLResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.AuthorizeURLResponse").msgclass CallbackRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.CallbackRequest").msgclass CallbackResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.CallbackResponse").msgclass + VerifyServiceAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.VerifyServiceAccountRequest").msgclass + VerifyServiceAccountResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.VerifyServiceAccountResponse").msgclass Method = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flipt.auth.Method").enummodule end end diff --git a/lib/auth/auth_services_pb.rb b/lib/auth/auth_services_pb.rb index 7c82cc9..5eb0115 100644 --- a/lib/auth/auth_services_pb.rb +++ b/lib/auth/auth_services_pb.rb @@ -65,6 +65,20 @@ class Service rpc :Callback, ::Flipt::Auth::CallbackRequest, ::Flipt::Auth::CallbackResponse end + Stub = Service.rpc_stub_class + end + module AuthenticationMethodKubernetesService + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'flipt.auth.AuthenticationMethodKubernetesService' + + rpc :VerifyServiceAccount, ::Flipt::Auth::VerifyServiceAccountRequest, ::Flipt::Auth::VerifyServiceAccountResponse + end + Stub = Service.rpc_stub_class end end diff --git a/lib/flipt_pb.rb b/lib/flipt_pb.rb index d37511a..50583bc 100644 --- a/lib/flipt_pb.rb +++ b/lib/flipt_pb.rb @@ -5,7 +5,6 @@ require 'google/protobuf/empty_pb' require 'google/protobuf/timestamp_pb' -require 'protoc-gen-openapiv2/options/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("flipt.proto", :syntax => :proto3) do diff --git a/lib/meta/meta_pb.rb b/lib/meta/meta_pb.rb index 8f2a571..0ac9539 100644 --- a/lib/meta/meta_pb.rb +++ b/lib/meta/meta_pb.rb @@ -5,7 +5,6 @@ require 'google/api/httpbody_pb' require 'google/protobuf/empty_pb' -require 'protoc-gen-openapiv2/options/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("meta/meta.proto", :syntax => :proto3) do