lib/tapioca/dsl/compilers/protobuf.rb in tapioca-0.14.3 vs lib/tapioca/dsl/compilers/protobuf.rb in tapioca-0.14.4
- old
+ new
@@ -27,11 +27,11 @@
# this compiler will produce the RBI file `cart.rbi` with the following content:
#
# ~~~rbi
# # cart.rbi
# # typed: strong
- # class Cart
+ # class Cart < Google::Protobuf::AbstractMessage
# sig { returns(Integer) }
# def customer_id; end
#
# sig { params(value: Integer).returns(Integer) }
# def customer_id=(value); end
@@ -121,9 +121,12 @@
"descriptor",
return_type: "Google::Protobuf::EnumDescriptor",
class_method: true,
)
when Google::Protobuf::Descriptor
+ raise "#{klass} is not a RBI::Class" unless klass.is_a?(RBI::Class)
+
+ klass.superclass_name = "Google::Protobuf::AbstractMessage"
descriptor.each_oneof { |oneof| create_oneof_method(klass, oneof) }
fields = descriptor.map { |desc| create_descriptor_method(klass, desc) }
fields.sort_by!(&:name)
parameters = fields.map do |field|