зеркало из https://github.com/arthurnn/twirp-ruby.git
Update example
This commit is contained in:
Родитель
1c2decec2e
Коммит
2a8e6c1146
|
@ -3,7 +3,7 @@ PATH
|
|||
specs:
|
||||
twirp (1.10.0)
|
||||
faraday (< 3)
|
||||
google-protobuf (~> 3.0, >= 3.7.0)
|
||||
google-protobuf (>= 3.25, < 5.a)
|
||||
rack (>= 2.2.3)
|
||||
|
||||
GEM
|
||||
|
@ -13,7 +13,7 @@ GEM
|
|||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-net_http (3.0.2)
|
||||
google-protobuf (3.21.12)
|
||||
google-protobuf (3.25.4)
|
||||
rack (2.2.8.1)
|
||||
ruby2_keywords (0.0.5)
|
||||
webrick (1.7.0)
|
||||
|
@ -22,6 +22,7 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
google-protobuf (~> 3.x)
|
||||
rack
|
||||
twirp!
|
||||
webrick
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: hello_world/service.proto
|
||||
|
||||
require 'google/protobuf'
|
||||
|
||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||
add_file("hello_world/service.proto", :syntax => :proto3) do
|
||||
add_message "example.hello_world.HelloRequest" do
|
||||
optional :name, :string, 1
|
||||
end
|
||||
add_message "example.hello_world.HelloResponse" do
|
||||
optional :message, :string, 1
|
||||
|
||||
descriptor_data = "\n\x19hello_world/service.proto\x12\x13\x65xample.hello_world\"\x1c\n\x0cHelloRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\" \n\rHelloResponse\x12\x0f\n\x07message\x18\x01 \x01(\t2\\\n\nHelloWorld\x12N\n\x05Hello\x12!.example.hello_world.HelloRequest\x1a\".example.hello_world.HelloResponseb\x06proto3"
|
||||
|
||||
pool = Google::Protobuf::DescriptorPool.generated_pool
|
||||
|
||||
begin
|
||||
pool.add_serialized_file(descriptor_data)
|
||||
rescue TypeError
|
||||
# Compatibility code: will be removed in the next major version.
|
||||
require 'google/protobuf/descriptor_pb'
|
||||
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
||||
parsed.clear_dependency
|
||||
serialized = parsed.class.encode(parsed)
|
||||
file = pool.add_serialized_file(serialized)
|
||||
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
||||
imports = [
|
||||
]
|
||||
imports.each do |type_name, expected_filename|
|
||||
import_file = pool.lookup(type_name).file_descriptor
|
||||
if import_file.name != expected_filename
|
||||
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
||||
end
|
||||
end
|
||||
warn "Each proto file must use a consistent fully-qualified name."
|
||||
warn "This will become an error in the next major version."
|
||||
end
|
||||
|
||||
module Example
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
|
||||
# Code generated by protoc-gen-twirp_ruby 1.10.1, DO NOT EDIT.
|
||||
require 'twirp'
|
||||
require_relative 'service_pb.rb'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче