gapic-generator/lib/gapic/schema/loader.rb
def load_message registry, descriptor, address, docs, path
        # Update Address.
        address = address.clone << descriptor.name

        # Load Children
        nested_messages = descriptor.nested_type.each_with_index.map do |m, i|
          load_message registry, m, address, docs, path + [3, i]
        end
        nested_enums = descriptor.enum_type.each_with_index.map do |e, i|
          load_enum registry, e, address, docs, path + [4, i]
        end
        fields = descriptor.field.each_with_index.map do |f, i|
          load_field registry, f, address, docs, path + [2, i]
        end
        extensions = descriptor.extension.each_with_index.map do |e, i|
          load_field registry, e, address, docs, path + [6, i]
        end

        resource_descriptor = descriptor.options[:".google.api.resource"] if descriptor.options
        resource = resource_descriptor ? Resource.new(resource_descriptor) : nil

        # Construct, cache, and return.
        msg = Message.new(descriptor, address, docs[path], fields, extensions,
                          resource, nested_messages, nested_enums)
        @prior_messages << msg
        add_to_registry registry, address, msg
      end
# Loads a message. As a side effect, this alters @messages and @enums
# with the nested messages that are found.
#
# @param descriptor [Google::Protobuf::DescriptorProto] the
#   descriptor of this message.
# @param address [Enumerable<String>] the address of the parent.
# @param docs [Hash<Enumerable<Integer>,
#   Google::Protobuf::SourceCodeInfo::Location>]
#   A mapping of a path to the docs. See Proto#docs for more info.
# @param path [Enumerable<Integer>] The current path. This is used to
#   get the docs for a proto. See Proto#docs for more info.
# @return [Message] The loaded message.
Loads a message. As a side effect, this alters @messages and @enums
with the nested messages that are found.
Loads a message . As a side effect this alters @messages and @enums with the nested messages that are found .
def load_message registry, descriptor, address, docs, path
        address = address.clone << descriptor.name
        nested_messages = descriptor.nested_type.each_with_index.map do |m, i|
          load_message registry, m, address, docs, path + [3, i]
        end
        nested_enums = descriptor.enum_type.each_with_index.map do |e, i|
          load_enum registry, e, address, docs, path + [4, i]
        end
        fields = descriptor.field.each_with_index.map do |f, i|
          load_field registry, f, address, docs, path + [2, i]
        end
        extensions = descriptor.extension.each_with_index.map do |e, i|
          load_field registry, e, address, docs, path + [6, i]
        end
        resource_descriptor = descriptor.options[:".google.api.resource"] if descriptor.options
        resource = resource_descriptor ? Resource.new(resource_descriptor) : nil
        msg = Message.new(descriptor, address, docs[path], fields, extensions,
                          resource, nested_messages, nested_enums)
        @prior_messages << msg
        add_to_registry registry, address, msg
      end
def load_message registry , descriptor , address , docs , path address = address . clone << descriptor . name nested_messages = descriptor . nested_type . each_with_index . map do | m , i | load_message registry , m , address , docs , path + [ 3 , i ] end nested_enums = descriptor . enum_type . each_with_index . map do | e , i | load_enum registry , e , address , docs , path + [ 4 , i ] end fields = descriptor . field . each_with_index . map do | f , i | load_field registry , f , address , docs , path + [ 2 , i ] end extensions = descriptor . extension . each_with_index . map do | e , i | load_field registry , e , address , docs , path + [ 6 , i ] end resource_descriptor = descriptor . options [ :" .google.api.resource " ] if descriptor . options resource = resource_descriptor ? Resource . new ( resource_descriptor ) : nil msg = Message . new ( descriptor , address , docs [ path ] , fields , extensions , resource , nested_messages , nested_enums ) @prior_messages << msg add_to_registry registry , address , msg end
Loads a message.
Loads a message .
# Update Address. # Load Children # Construct, cache, and return.
The loaded message.
The loaded message .
Message
registry
descriptor
the descriptor of this message.
the descriptor of this message .
address
the address of the parent.
the address of the parent .
docs
A mapping of a path to the docs. See Proto#docs for more info.
A mapping of a path to the docs . See Proto#docs for more info .
path
The current path. This is used to get the docs for a proto. See Proto#docs for more info.
The current path . This is used to get the docs for a proto . See Proto#docs for more info .