Committing vendored dependencies and generated protos

Change-Id: I349c149b513d9de7d9f60bde2c954a939da2fc54
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/BUILD.bazel
new file mode 100644
index 0000000..cfbdc27
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/BUILD.bazel
@@ -0,0 +1,44 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+package(default_visibility = ["//:generators"])
+
+go_library(
+    name = "go_default_library",
+    srcs = [
+        "grpc_api_configuration.go",
+        "grpc_api_service.go",
+        "registry.go",
+        "services.go",
+        "types.go",
+    ],
+    importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor",
+    deps = [
+        "//protoc-gen-grpc-gateway/httprule:go_default_library",
+        "@com_github_ghodss_yaml//:go_default_library",
+        "@com_github_golang_glog//:go_default_library",
+        "@com_github_golang_protobuf//jsonpb:go_default_library_gen",
+        "@com_github_golang_protobuf//proto:go_default_library",
+        "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen",
+        "@go_googleapis//google/api:annotations_go_proto",
+        "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
+        "@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
+    ],
+)
+
+go_test(
+    name = "go_default_test",
+    size = "small",
+    srcs = [
+        "grpc_api_configuration_test.go",
+        "registry_test.go",
+        "services_test.go",
+        "types_test.go",
+    ],
+    embed = [":go_default_library"],
+    deps = [
+        "//protoc-gen-grpc-gateway/httprule:go_default_library",
+        "@com_github_golang_protobuf//proto:go_default_library",
+        "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
+        "@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
+    ],
+)
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go
new file mode 100644
index 0000000..ca68ed7
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go
@@ -0,0 +1,71 @@
+package descriptor
+
+import (
+	"bytes"
+	"fmt"
+	"io/ioutil"
+	"strings"
+
+	"github.com/ghodss/yaml"
+	"github.com/golang/protobuf/jsonpb"
+)
+
+func loadGrpcAPIServiceFromYAML(yamlFileContents []byte, yamlSourceLogName string) (*GrpcAPIService, error) {
+	jsonContents, err := yaml.YAMLToJSON(yamlFileContents)
+	if err != nil {
+		return nil, fmt.Errorf("Failed to convert gRPC API Configuration from YAML in '%v' to JSON: %v", yamlSourceLogName, err)
+	}
+
+	// As our GrpcAPIService is incomplete accept unkown fields.
+	unmarshaler := jsonpb.Unmarshaler{
+		AllowUnknownFields: true,
+	}
+
+	serviceConfiguration := GrpcAPIService{}
+	if err := unmarshaler.Unmarshal(bytes.NewReader(jsonContents), &serviceConfiguration); err != nil {
+		return nil, fmt.Errorf("Failed to parse gRPC API Configuration from YAML in '%v': %v", yamlSourceLogName, err)
+	}
+
+	return &serviceConfiguration, nil
+}
+
+func registerHTTPRulesFromGrpcAPIService(registry *Registry, service *GrpcAPIService, sourceLogName string) error {
+	if service.HTTP == nil {
+		// Nothing to do
+		return nil
+	}
+
+	for _, rule := range service.HTTP.GetRules() {
+		selector := "." + strings.Trim(rule.GetSelector(), " ")
+		if strings.ContainsAny(selector, "*, ") {
+			return fmt.Errorf("Selector '%v' in %v must specify a single service method without wildcards", rule.GetSelector(), sourceLogName)
+		}
+
+		registry.AddExternalHTTPRule(selector, rule)
+	}
+
+	return nil
+}
+
+// LoadGrpcAPIServiceFromYAML loads a gRPC API Configuration from the given YAML file
+// and registers the HttpRule descriptions contained in it as externalHTTPRules in
+// the given registry. This must be done before loading the proto file.
+//
+// You can learn more about gRPC API Service descriptions from google's documentation
+// at https://cloud.google.com/endpoints/docs/grpc/grpc-service-config
+//
+// Note that for the purposes of the gateway generator we only consider a subset of all
+// available features google supports in their service descriptions.
+func (r *Registry) LoadGrpcAPIServiceFromYAML(yamlFile string) error {
+	yamlFileContents, err := ioutil.ReadFile(yamlFile)
+	if err != nil {
+		return fmt.Errorf("Failed to read gRPC API Configuration description from '%v': %v", yamlFile, err)
+	}
+
+	service, err := loadGrpcAPIServiceFromYAML(yamlFileContents, yamlFile)
+	if err != nil {
+		return err
+	}
+
+	return registerHTTPRulesFromGrpcAPIService(r, service, yamlFile)
+}
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go
new file mode 100644
index 0000000..75b8240
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go
@@ -0,0 +1,31 @@
+package descriptor

+

+import (

+	"github.com/golang/protobuf/proto"

+	"google.golang.org/genproto/googleapis/api/annotations"

+)

+

+// GrpcAPIService represents a stripped down version of google.api.Service .

+// Compare to https://github.com/googleapis/googleapis/blob/master/google/api/service.proto

+// The original imports 23 other protobuf files we are not interested in. If a significant

+// subset (>50%) of these start being reproduced in this file we should swap to using the

+// full generated version instead.

+//

+// For the purposes of the gateway generator we only consider a small subset of all

+// available features google supports in their service descriptions. Thanks to backwards

+// compatibility guarantees by protobuf it is safe for us to remove the other fields.

+// We also only implement the absolute minimum of protobuf generator boilerplate to use

+// our simplified version. These should be pretty stable too.

+type GrpcAPIService struct {

+	// Http Rule. Named Http in the actual proto. Changed to suppress linter warning.

+	HTTP *annotations.Http `protobuf:"bytes,9,opt,name=http" json:"http,omitempty"`

+}

+

+// ProtoMessage returns an empty GrpcAPIService element

+func (*GrpcAPIService) ProtoMessage() {}

+

+// Reset resets the GrpcAPIService

+func (m *GrpcAPIService) Reset() { *m = GrpcAPIService{} }

+

+// String returns the string representation of the GrpcAPIService

+func (m *GrpcAPIService) String() string { return proto.CompactTextString(m) }

diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go
new file mode 100644
index 0000000..2f05636
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go
@@ -0,0 +1,498 @@
+package descriptor
+
+import (
+	"fmt"
+	"path"
+	"path/filepath"
+	"strings"
+
+	"github.com/golang/glog"
+	descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
+	plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
+	"google.golang.org/genproto/googleapis/api/annotations"
+)
+
+// Registry is a registry of information extracted from plugin.CodeGeneratorRequest.
+type Registry struct {
+	// msgs is a mapping from fully-qualified message name to descriptor
+	msgs map[string]*Message
+
+	// enums is a mapping from fully-qualified enum name to descriptor
+	enums map[string]*Enum
+
+	// files is a mapping from file path to descriptor
+	files map[string]*File
+
+	// prefix is a prefix to be inserted to golang package paths generated from proto package names.
+	prefix string
+
+	// importPath is used as the package if no input files declare go_package. If it contains slashes, everything up to the rightmost slash is ignored.
+	importPath string
+
+	// pkgMap is a user-specified mapping from file path to proto package.
+	pkgMap map[string]string
+
+	// pkgAliases is a mapping from package aliases to package paths in go which are already taken.
+	pkgAliases map[string]string
+
+	// allowDeleteBody permits http delete methods to have a body
+	allowDeleteBody bool
+
+	// externalHttpRules is a mapping from fully qualified service method names to additional HttpRules applicable besides the ones found in annotations.
+	externalHTTPRules map[string][]*annotations.HttpRule
+
+	// allowMerge generation one swagger file out of multiple protos
+	allowMerge bool
+
+	// mergeFileName target swagger file name after merge
+	mergeFileName string
+
+	// allowRepeatedFieldsInBody permits repeated field in body field path of `google.api.http` annotation option
+	allowRepeatedFieldsInBody bool
+
+	// includePackageInTags controls whether the package name defined in the `package` directive
+	// in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation.
+	includePackageInTags bool
+
+	// repeatedPathParamSeparator specifies how path parameter repeated fields are separated
+	repeatedPathParamSeparator repeatedFieldSeparator
+
+	// useJSONNamesForFields if true json tag name is used for generating fields in swagger definitions,
+	// otherwise the original proto name is used. It's helpful for synchronizing the swagger definition
+	// with grpc-gateway response, if it uses json tags for marshaling.
+	useJSONNamesForFields bool
+
+	// useFQNForSwaggerName if true swagger names will use the full qualified name (FQN) from proto definition,
+	// and generate a dot-separated swagger name concatenating all elements from the proto FQN.
+	// If false, the default behavior is to concat the last 2 elements of the FQN if they are unique, otherwise concat
+	// all the elements of the FQN without any separator
+	useFQNForSwaggerName bool
+
+	// allowColonFinalSegments determines whether colons are permitted
+	// in the final segment of a path.
+	allowColonFinalSegments bool
+}
+
+type repeatedFieldSeparator struct {
+	name string
+	sep  rune
+}
+
+// NewRegistry returns a new Registry.
+func NewRegistry() *Registry {
+	return &Registry{
+		msgs:              make(map[string]*Message),
+		enums:             make(map[string]*Enum),
+		files:             make(map[string]*File),
+		pkgMap:            make(map[string]string),
+		pkgAliases:        make(map[string]string),
+		externalHTTPRules: make(map[string][]*annotations.HttpRule),
+		repeatedPathParamSeparator: repeatedFieldSeparator{
+			name: "csv",
+			sep:  ',',
+		},
+	}
+}
+
+// Load loads definitions of services, methods, messages, enumerations and fields from "req".
+func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error {
+	for _, file := range req.GetProtoFile() {
+		r.loadFile(file)
+	}
+
+	var targetPkg string
+	for _, name := range req.FileToGenerate {
+		target := r.files[name]
+		if target == nil {
+			return fmt.Errorf("no such file: %s", name)
+		}
+		name := r.packageIdentityName(target.FileDescriptorProto)
+		if targetPkg == "" {
+			targetPkg = name
+		} else {
+			if targetPkg != name {
+				return fmt.Errorf("inconsistent package names: %s %s", targetPkg, name)
+			}
+		}
+
+		if err := r.loadServices(target); err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+// loadFile loads messages, enumerations and fields from "file".
+// It does not loads services and methods in "file".  You need to call
+// loadServices after loadFiles is called for all files to load services and methods.
+func (r *Registry) loadFile(file *descriptor.FileDescriptorProto) {
+	pkg := GoPackage{
+		Path: r.goPackagePath(file),
+		Name: r.defaultGoPackageName(file),
+	}
+	if err := r.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil {
+		for i := 0; ; i++ {
+			alias := fmt.Sprintf("%s_%d", pkg.Name, i)
+			if err := r.ReserveGoPackageAlias(alias, pkg.Path); err == nil {
+				pkg.Alias = alias
+				break
+			}
+		}
+	}
+	f := &File{
+		FileDescriptorProto: file,
+		GoPkg:               pkg,
+	}
+
+	r.files[file.GetName()] = f
+	r.registerMsg(f, nil, file.GetMessageType())
+	r.registerEnum(f, nil, file.GetEnumType())
+}
+
+func (r *Registry) registerMsg(file *File, outerPath []string, msgs []*descriptor.DescriptorProto) {
+	for i, md := range msgs {
+		m := &Message{
+			File:            file,
+			Outers:          outerPath,
+			DescriptorProto: md,
+			Index:           i,
+		}
+		for _, fd := range md.GetField() {
+			m.Fields = append(m.Fields, &Field{
+				Message:              m,
+				FieldDescriptorProto: fd,
+			})
+		}
+		file.Messages = append(file.Messages, m)
+		r.msgs[m.FQMN()] = m
+		glog.V(1).Infof("register name: %s", m.FQMN())
+
+		var outers []string
+		outers = append(outers, outerPath...)
+		outers = append(outers, m.GetName())
+		r.registerMsg(file, outers, m.GetNestedType())
+		r.registerEnum(file, outers, m.GetEnumType())
+	}
+}
+
+func (r *Registry) registerEnum(file *File, outerPath []string, enums []*descriptor.EnumDescriptorProto) {
+	for i, ed := range enums {
+		e := &Enum{
+			File:                file,
+			Outers:              outerPath,
+			EnumDescriptorProto: ed,
+			Index:               i,
+		}
+		file.Enums = append(file.Enums, e)
+		r.enums[e.FQEN()] = e
+		glog.V(1).Infof("register enum name: %s", e.FQEN())
+	}
+}
+
+// LookupMsg looks up a message type by "name".
+// It tries to resolve "name" from "location" if "name" is a relative message name.
+func (r *Registry) LookupMsg(location, name string) (*Message, error) {
+	glog.V(1).Infof("lookup %s from %s", name, location)
+	if strings.HasPrefix(name, ".") {
+		m, ok := r.msgs[name]
+		if !ok {
+			return nil, fmt.Errorf("no message found: %s", name)
+		}
+		return m, nil
+	}
+
+	if !strings.HasPrefix(location, ".") {
+		location = fmt.Sprintf(".%s", location)
+	}
+	components := strings.Split(location, ".")
+	for len(components) > 0 {
+		fqmn := strings.Join(append(components, name), ".")
+		if m, ok := r.msgs[fqmn]; ok {
+			return m, nil
+		}
+		components = components[:len(components)-1]
+	}
+	return nil, fmt.Errorf("no message found: %s", name)
+}
+
+// LookupEnum looks up a enum type by "name".
+// It tries to resolve "name" from "location" if "name" is a relative enum name.
+func (r *Registry) LookupEnum(location, name string) (*Enum, error) {
+	glog.V(1).Infof("lookup enum %s from %s", name, location)
+	if strings.HasPrefix(name, ".") {
+		e, ok := r.enums[name]
+		if !ok {
+			return nil, fmt.Errorf("no enum found: %s", name)
+		}
+		return e, nil
+	}
+
+	if !strings.HasPrefix(location, ".") {
+		location = fmt.Sprintf(".%s", location)
+	}
+	components := strings.Split(location, ".")
+	for len(components) > 0 {
+		fqen := strings.Join(append(components, name), ".")
+		if e, ok := r.enums[fqen]; ok {
+			return e, nil
+		}
+		components = components[:len(components)-1]
+	}
+	return nil, fmt.Errorf("no enum found: %s", name)
+}
+
+// LookupFile looks up a file by name.
+func (r *Registry) LookupFile(name string) (*File, error) {
+	f, ok := r.files[name]
+	if !ok {
+		return nil, fmt.Errorf("no such file given: %s", name)
+	}
+	return f, nil
+}
+
+// LookupExternalHTTPRules looks up external http rules by fully qualified service method name
+func (r *Registry) LookupExternalHTTPRules(qualifiedMethodName string) []*annotations.HttpRule {
+	return r.externalHTTPRules[qualifiedMethodName]
+}
+
+// AddExternalHTTPRule adds an external http rule for the given fully qualified service method name
+func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotations.HttpRule) {
+	r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule)
+}
+
+// AddPkgMap adds a mapping from a .proto file to proto package name.
+func (r *Registry) AddPkgMap(file, protoPkg string) {
+	r.pkgMap[file] = protoPkg
+}
+
+// SetPrefix registers the prefix to be added to go package paths generated from proto package names.
+func (r *Registry) SetPrefix(prefix string) {
+	r.prefix = prefix
+}
+
+// SetImportPath registers the importPath which is used as the package if no
+// input files declare go_package. If it contains slashes, everything up to the
+// rightmost slash is ignored.
+func (r *Registry) SetImportPath(importPath string) {
+	r.importPath = importPath
+}
+
+// ReserveGoPackageAlias reserves the unique alias of go package.
+// If succeeded, the alias will be never used for other packages in generated go files.
+// If failed, the alias is already taken by another package, so you need to use another
+// alias for the package in your go files.
+func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error {
+	if taken, ok := r.pkgAliases[alias]; ok {
+		if taken == pkgpath {
+			return nil
+		}
+		return fmt.Errorf("package name %s is already taken. Use another alias", alias)
+	}
+	r.pkgAliases[alias] = pkgpath
+	return nil
+}
+
+// goPackagePath returns the go package path which go files generated from "f" should have.
+// It respects the mapping registered by AddPkgMap if exists. Or use go_package as import path
+// if it includes a slash,  Otherwide, it generates a path from the file name of "f".
+func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string {
+	name := f.GetName()
+	if pkg, ok := r.pkgMap[name]; ok {
+		return path.Join(r.prefix, pkg)
+	}
+
+	gopkg := f.Options.GetGoPackage()
+	idx := strings.LastIndex(gopkg, "/")
+	if idx >= 0 {
+		if sc := strings.LastIndex(gopkg, ";"); sc > 0 {
+			gopkg = gopkg[:sc+1-1]
+		}
+		return gopkg
+	}
+
+	return path.Join(r.prefix, path.Dir(name))
+}
+
+// GetAllFQMNs returns a list of all FQMNs
+func (r *Registry) GetAllFQMNs() []string {
+	var keys []string
+	for k := range r.msgs {
+		keys = append(keys, k)
+	}
+	return keys
+}
+
+// GetAllFQENs returns a list of all FQENs
+func (r *Registry) GetAllFQENs() []string {
+	var keys []string
+	for k := range r.enums {
+		keys = append(keys, k)
+	}
+	return keys
+}
+
+// SetAllowDeleteBody controls whether http delete methods may have a
+// body or fail loading if encountered.
+func (r *Registry) SetAllowDeleteBody(allow bool) {
+	r.allowDeleteBody = allow
+}
+
+// SetAllowMerge controls whether generation one swagger file out of multiple protos
+func (r *Registry) SetAllowMerge(allow bool) {
+	r.allowMerge = allow
+}
+
+// IsAllowMerge whether generation one swagger file out of multiple protos
+func (r *Registry) IsAllowMerge() bool {
+	return r.allowMerge
+}
+
+// SetMergeFileName controls the target swagger file name out of multiple protos
+func (r *Registry) SetMergeFileName(mergeFileName string) {
+	r.mergeFileName = mergeFileName
+}
+
+// SetAllowRepeatedFieldsInBody controls whether repeated field can be used
+// in `body` and `response_body` (`google.api.http` annotation option) field path or not
+func (r *Registry) SetAllowRepeatedFieldsInBody(allow bool) {
+	r.allowRepeatedFieldsInBody = allow
+}
+
+// IsAllowRepeatedFieldsInBody checks if repeated field can be used
+// in `body` and `response_body` (`google.api.http` annotation option) field path or not
+func (r *Registry) IsAllowRepeatedFieldsInBody() bool {
+	return r.allowRepeatedFieldsInBody
+}
+
+// SetIncludePackageInTags controls whether the package name defined in the `package` directive
+// in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation.
+func (r *Registry) SetIncludePackageInTags(allow bool) {
+	r.includePackageInTags = allow
+}
+
+// IsIncludePackageInTags checks whether the package name defined in the `package` directive
+// in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation.
+func (r *Registry) IsIncludePackageInTags() bool {
+	return r.includePackageInTags
+}
+
+// GetRepeatedPathParamSeparator returns a rune spcifying how
+// path parameter repeated fields are separated.
+func (r *Registry) GetRepeatedPathParamSeparator() rune {
+	return r.repeatedPathParamSeparator.sep
+}
+
+// GetRepeatedPathParamSeparatorName returns the name path parameter repeated
+// fields repeatedFieldSeparator. I.e. 'csv', 'pipe', 'ssv' or 'tsv'
+func (r *Registry) GetRepeatedPathParamSeparatorName() string {
+	return r.repeatedPathParamSeparator.name
+}
+
+// SetRepeatedPathParamSeparator sets how path parameter repeated fields are
+// separated. Allowed names are 'csv', 'pipe', 'ssv' and 'tsv'.
+func (r *Registry) SetRepeatedPathParamSeparator(name string) error {
+	var sep rune
+	switch name {
+	case "csv":
+		sep = ','
+	case "pipes":
+		sep = '|'
+	case "ssv":
+		sep = ' '
+	case "tsv":
+		sep = '\t'
+	default:
+		return fmt.Errorf("unknown repeated path parameter separator: %s", name)
+	}
+	r.repeatedPathParamSeparator = repeatedFieldSeparator{
+		name: name,
+		sep:  sep,
+	}
+	return nil
+}
+
+// SetUseJSONNamesForFields sets useJSONNamesForFields
+func (r *Registry) SetUseJSONNamesForFields(use bool) {
+	r.useJSONNamesForFields = use
+}
+
+// GetUseJSONNamesForFields returns useJSONNamesForFields
+func (r *Registry) GetUseJSONNamesForFields() bool {
+	return r.useJSONNamesForFields
+}
+
+// SetUseFQNForSwaggerName sets useFQNForSwaggerName
+func (r *Registry) SetUseFQNForSwaggerName(use bool) {
+	r.useFQNForSwaggerName = use
+}
+
+// GetAllowColonFinalSegments returns allowColonFinalSegments
+func (r *Registry) GetAllowColonFinalSegments() bool {
+	return r.allowColonFinalSegments
+}
+
+// SetAllowColonFinalSegments sets allowColonFinalSegments
+func (r *Registry) SetAllowColonFinalSegments(use bool) {
+	r.allowColonFinalSegments = use
+}
+
+// GetUseFQNForSwaggerName returns useFQNForSwaggerName
+func (r *Registry) GetUseFQNForSwaggerName() bool {
+	return r.useFQNForSwaggerName
+}
+
+// GetMergeFileName return the target merge swagger file name
+func (r *Registry) GetMergeFileName() string {
+	return r.mergeFileName
+}
+
+// sanitizePackageName replaces unallowed character in package name
+// with allowed character.
+func sanitizePackageName(pkgName string) string {
+	pkgName = strings.Replace(pkgName, ".", "_", -1)
+	pkgName = strings.Replace(pkgName, "-", "_", -1)
+	return pkgName
+}
+
+// defaultGoPackageName returns the default go package name to be used for go files generated from "f".
+// You might need to use an unique alias for the package when you import it.  Use ReserveGoPackageAlias to get a unique alias.
+func (r *Registry) defaultGoPackageName(f *descriptor.FileDescriptorProto) string {
+	name := r.packageIdentityName(f)
+	return sanitizePackageName(name)
+}
+
+// packageIdentityName returns the identity of packages.
+// protoc-gen-grpc-gateway rejects CodeGenerationRequests which contains more than one packages
+// as protoc-gen-go does.
+func (r *Registry) packageIdentityName(f *descriptor.FileDescriptorProto) string {
+	if f.Options != nil && f.Options.GoPackage != nil {
+		gopkg := f.Options.GetGoPackage()
+		idx := strings.LastIndex(gopkg, "/")
+		if idx < 0 {
+			gopkg = gopkg[idx+1:]
+		}
+
+		gopkg = gopkg[idx+1:]
+		// package name is overrided with the string after the
+		// ';' character
+		sc := strings.IndexByte(gopkg, ';')
+		if sc < 0 {
+			return sanitizePackageName(gopkg)
+
+		}
+		return sanitizePackageName(gopkg[sc+1:])
+	}
+	if p := r.importPath; len(p) != 0 {
+		if i := strings.LastIndex(p, "/"); i >= 0 {
+			p = p[i+1:]
+		}
+		return p
+	}
+
+	if f.Package == nil {
+		base := filepath.Base(f.GetName())
+		ext := filepath.Ext(base)
+		return strings.TrimSuffix(base, ext)
+	}
+	return f.GetPackage()
+}
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go
new file mode 100644
index 0000000..8916d31
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go
@@ -0,0 +1,304 @@
+package descriptor
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/golang/glog"
+	"github.com/golang/protobuf/proto"
+	descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
+	"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule"
+	options "google.golang.org/genproto/googleapis/api/annotations"
+)
+
+// loadServices registers services and their methods from "targetFile" to "r".
+// It must be called after loadFile is called for all files so that loadServices
+// can resolve names of message types and their fields.
+func (r *Registry) loadServices(file *File) error {
+	glog.V(1).Infof("Loading services from %s", file.GetName())
+	var svcs []*Service
+	for _, sd := range file.GetService() {
+		glog.V(2).Infof("Registering %s", sd.GetName())
+		svc := &Service{
+			File: file,
+			ServiceDescriptorProto: sd,
+		}
+		for _, md := range sd.GetMethod() {
+			glog.V(2).Infof("Processing %s.%s", sd.GetName(), md.GetName())
+			opts, err := extractAPIOptions(md)
+			if err != nil {
+				glog.Errorf("Failed to extract HttpRule from %s.%s: %v", svc.GetName(), md.GetName(), err)
+				return err
+			}
+			optsList := r.LookupExternalHTTPRules((&Method{Service: svc, MethodDescriptorProto: md}).FQMN())
+			if opts != nil {
+				optsList = append(optsList, opts)
+			}
+			if len(optsList) == 0 {
+				glog.V(1).Infof("Found non-target method: %s.%s", svc.GetName(), md.GetName())
+			}
+			meth, err := r.newMethod(svc, md, optsList)
+			if err != nil {
+				return err
+			}
+			svc.Methods = append(svc.Methods, meth)
+		}
+		if len(svc.Methods) == 0 {
+			continue
+		}
+		glog.V(2).Infof("Registered %s with %d method(s)", svc.GetName(), len(svc.Methods))
+		svcs = append(svcs, svc)
+	}
+	file.Services = svcs
+	return nil
+}
+
+func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, optsList []*options.HttpRule) (*Method, error) {
+	requestType, err := r.LookupMsg(svc.File.GetPackage(), md.GetInputType())
+	if err != nil {
+		return nil, err
+	}
+	responseType, err := r.LookupMsg(svc.File.GetPackage(), md.GetOutputType())
+	if err != nil {
+		return nil, err
+	}
+	meth := &Method{
+		Service:               svc,
+		MethodDescriptorProto: md,
+		RequestType:           requestType,
+		ResponseType:          responseType,
+	}
+
+	newBinding := func(opts *options.HttpRule, idx int) (*Binding, error) {
+		var (
+			httpMethod   string
+			pathTemplate string
+		)
+		switch {
+		case opts.GetGet() != "":
+			httpMethod = "GET"
+			pathTemplate = opts.GetGet()
+			if opts.Body != "" {
+				return nil, fmt.Errorf("must not set request body when http method is GET: %s", md.GetName())
+			}
+
+		case opts.GetPut() != "":
+			httpMethod = "PUT"
+			pathTemplate = opts.GetPut()
+
+		case opts.GetPost() != "":
+			httpMethod = "POST"
+			pathTemplate = opts.GetPost()
+
+		case opts.GetDelete() != "":
+			httpMethod = "DELETE"
+			pathTemplate = opts.GetDelete()
+			if opts.Body != "" && !r.allowDeleteBody {
+				return nil, fmt.Errorf("must not set request body when http method is DELETE except allow_delete_body option is true: %s", md.GetName())
+			}
+
+		case opts.GetPatch() != "":
+			httpMethod = "PATCH"
+			pathTemplate = opts.GetPatch()
+
+		case opts.GetCustom() != nil:
+			custom := opts.GetCustom()
+			httpMethod = custom.Kind
+			pathTemplate = custom.Path
+
+		default:
+			glog.V(1).Infof("No pattern specified in google.api.HttpRule: %s", md.GetName())
+			return nil, nil
+		}
+
+		parsed, err := httprule.Parse(pathTemplate)
+		if err != nil {
+			return nil, err
+		}
+		tmpl := parsed.Compile()
+
+		if md.GetClientStreaming() && len(tmpl.Fields) > 0 {
+			return nil, fmt.Errorf("cannot use path parameter in client streaming")
+		}
+
+		b := &Binding{
+			Method:     meth,
+			Index:      idx,
+			PathTmpl:   tmpl,
+			HTTPMethod: httpMethod,
+		}
+
+		for _, f := range tmpl.Fields {
+			param, err := r.newParam(meth, f)
+			if err != nil {
+				return nil, err
+			}
+			b.PathParams = append(b.PathParams, param)
+		}
+
+		// TODO(yugui) Handle query params
+
+		b.Body, err = r.newBody(meth, opts.Body)
+		if err != nil {
+			return nil, err
+		}
+
+		b.ResponseBody, err = r.newResponse(meth, opts.ResponseBody)
+		if err != nil {
+			return nil, err
+		}
+
+		return b, nil
+	}
+
+	applyOpts := func(opts *options.HttpRule) error {
+		b, err := newBinding(opts, len(meth.Bindings))
+		if err != nil {
+			return err
+		}
+
+		if b != nil {
+			meth.Bindings = append(meth.Bindings, b)
+		}
+		for _, additional := range opts.GetAdditionalBindings() {
+			if len(additional.AdditionalBindings) > 0 {
+				return fmt.Errorf("additional_binding in additional_binding not allowed: %s.%s", svc.GetName(), meth.GetName())
+			}
+			b, err := newBinding(additional, len(meth.Bindings))
+			if err != nil {
+				return err
+			}
+			meth.Bindings = append(meth.Bindings, b)
+		}
+
+		return nil
+	}
+
+	for _, opts := range optsList {
+		if err := applyOpts(opts); err != nil {
+			return nil, err
+		}
+	}
+
+	return meth, nil
+}
+
+func extractAPIOptions(meth *descriptor.MethodDescriptorProto) (*options.HttpRule, error) {
+	if meth.Options == nil {
+		return nil, nil
+	}
+	if !proto.HasExtension(meth.Options, options.E_Http) {
+		return nil, nil
+	}
+	ext, err := proto.GetExtension(meth.Options, options.E_Http)
+	if err != nil {
+		return nil, err
+	}
+	opts, ok := ext.(*options.HttpRule)
+	if !ok {
+		return nil, fmt.Errorf("extension is %T; want an HttpRule", ext)
+	}
+	return opts, nil
+}
+
+func (r *Registry) newParam(meth *Method, path string) (Parameter, error) {
+	msg := meth.RequestType
+	fields, err := r.resolveFieldPath(msg, path, true)
+	if err != nil {
+		return Parameter{}, err
+	}
+	l := len(fields)
+	if l == 0 {
+		return Parameter{}, fmt.Errorf("invalid field access list for %s", path)
+	}
+	target := fields[l-1].Target
+	switch target.GetType() {
+	case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_GROUP:
+		glog.V(2).Infoln("found aggregate type:", target, target.TypeName)
+		if IsWellKnownType(*target.TypeName) {
+			glog.V(2).Infoln("found well known aggregate type:", target)
+		} else {
+			return Parameter{}, fmt.Errorf("aggregate type %s in parameter of %s.%s: %s", target.Type, meth.Service.GetName(), meth.GetName(), path)
+		}
+	}
+	return Parameter{
+		FieldPath: FieldPath(fields),
+		Method:    meth,
+		Target:    fields[l-1].Target,
+	}, nil
+}
+
+func (r *Registry) newBody(meth *Method, path string) (*Body, error) {
+	msg := meth.RequestType
+	switch path {
+	case "":
+		return nil, nil
+	case "*":
+		return &Body{FieldPath: nil}, nil
+	}
+	fields, err := r.resolveFieldPath(msg, path, false)
+	if err != nil {
+		return nil, err
+	}
+	return &Body{FieldPath: FieldPath(fields)}, nil
+}
+
+func (r *Registry) newResponse(meth *Method, path string) (*Body, error) {
+	msg := meth.ResponseType
+	switch path {
+	case "", "*":
+		return nil, nil
+	}
+	fields, err := r.resolveFieldPath(msg, path, false)
+	if err != nil {
+		return nil, err
+	}
+	return &Body{FieldPath: FieldPath(fields)}, nil
+}
+
+// lookupField looks up a field named "name" within "msg".
+// It returns nil if no such field found.
+func lookupField(msg *Message, name string) *Field {
+	for _, f := range msg.Fields {
+		if f.GetName() == name {
+			return f
+		}
+	}
+	return nil
+}
+
+// resolveFieldPath resolves "path" into a list of fieldDescriptor, starting from "msg".
+func (r *Registry) resolveFieldPath(msg *Message, path string, isPathParam bool) ([]FieldPathComponent, error) {
+	if path == "" {
+		return nil, nil
+	}
+
+	root := msg
+	var result []FieldPathComponent
+	for i, c := range strings.Split(path, ".") {
+		if i > 0 {
+			f := result[i-1].Target
+			switch f.GetType() {
+			case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_GROUP:
+				var err error
+				msg, err = r.LookupMsg(msg.FQMN(), f.GetTypeName())
+				if err != nil {
+					return nil, err
+				}
+			default:
+				return nil, fmt.Errorf("not an aggregate type: %s in %s", f.GetName(), path)
+			}
+		}
+
+		glog.V(2).Infof("Lookup %s in %s", c, msg.FQMN())
+		f := lookupField(msg, c)
+		if f == nil {
+			return nil, fmt.Errorf("no field %q found in %s", path, root.GetName())
+		}
+		if !(isPathParam || r.allowRepeatedFieldsInBody) && f.GetLabel() == descriptor.FieldDescriptorProto_LABEL_REPEATED {
+			return nil, fmt.Errorf("repeated field not allowed in field path: %s in %s", f.GetName(), path)
+		}
+		result = append(result, FieldPathComponent{Name: c, Target: f})
+	}
+	return result, nil
+}
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go
new file mode 100644
index 0000000..4aa75f8
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go
@@ -0,0 +1,466 @@
+package descriptor
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/golang/protobuf/protoc-gen-go/descriptor"
+	gogen "github.com/golang/protobuf/protoc-gen-go/generator"
+	"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule"
+)
+
+// IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'.
+func IsWellKnownType(typeName string) bool {
+	_, ok := wellKnownTypeConv[typeName]
+	return ok
+}
+
+// GoPackage represents a golang package
+type GoPackage struct {
+	// Path is the package path to the package.
+	Path string
+	// Name is the package name of the package
+	Name string
+	// Alias is an alias of the package unique within the current invokation of grpc-gateway generator.
+	Alias string
+}
+
+// Standard returns whether the import is a golang standard package.
+func (p GoPackage) Standard() bool {
+	return !strings.Contains(p.Path, ".")
+}
+
+// String returns a string representation of this package in the form of import line in golang.
+func (p GoPackage) String() string {
+	if p.Alias == "" {
+		return fmt.Sprintf("%q", p.Path)
+	}
+	return fmt.Sprintf("%s %q", p.Alias, p.Path)
+}
+
+// File wraps descriptor.FileDescriptorProto for richer features.
+type File struct {
+	*descriptor.FileDescriptorProto
+	// GoPkg is the go package of the go file generated from this file..
+	GoPkg GoPackage
+	// Messages is the list of messages defined in this file.
+	Messages []*Message
+	// Enums is the list of enums defined in this file.
+	Enums []*Enum
+	// Services is the list of services defined in this file.
+	Services []*Service
+}
+
+// proto2 determines if the syntax of the file is proto2.
+func (f *File) proto2() bool {
+	return f.Syntax == nil || f.GetSyntax() == "proto2"
+}
+
+// Message describes a protocol buffer message types
+type Message struct {
+	// File is the file where the message is defined
+	File *File
+	// Outers is a list of outer messages if this message is a nested type.
+	Outers []string
+	*descriptor.DescriptorProto
+	Fields []*Field
+
+	// Index is proto path index of this message in File.
+	Index int
+}
+
+// FQMN returns a fully qualified message name of this message.
+func (m *Message) FQMN() string {
+	components := []string{""}
+	if m.File.Package != nil {
+		components = append(components, m.File.GetPackage())
+	}
+	components = append(components, m.Outers...)
+	components = append(components, m.GetName())
+	return strings.Join(components, ".")
+}
+
+// GoType returns a go type name for the message type.
+// It prefixes the type name with the package alias if
+// its belonging package is not "currentPackage".
+func (m *Message) GoType(currentPackage string) string {
+	var components []string
+	components = append(components, m.Outers...)
+	components = append(components, m.GetName())
+
+	name := strings.Join(components, "_")
+	if m.File.GoPkg.Path == currentPackage {
+		return name
+	}
+	pkg := m.File.GoPkg.Name
+	if alias := m.File.GoPkg.Alias; alias != "" {
+		pkg = alias
+	}
+	return fmt.Sprintf("%s.%s", pkg, name)
+}
+
+// Enum describes a protocol buffer enum types
+type Enum struct {
+	// File is the file where the enum is defined
+	File *File
+	// Outers is a list of outer messages if this enum is a nested type.
+	Outers []string
+	*descriptor.EnumDescriptorProto
+
+	Index int
+}
+
+// FQEN returns a fully qualified enum name of this enum.
+func (e *Enum) FQEN() string {
+	components := []string{""}
+	if e.File.Package != nil {
+		components = append(components, e.File.GetPackage())
+	}
+	components = append(components, e.Outers...)
+	components = append(components, e.GetName())
+	return strings.Join(components, ".")
+}
+
+// GoType returns a go type name for the enum type.
+// It prefixes the type name with the package alias if
+// its belonging package is not "currentPackage".
+func (e *Enum) GoType(currentPackage string) string {
+	var components []string
+	components = append(components, e.Outers...)
+	components = append(components, e.GetName())
+
+	name := strings.Join(components, "_")
+	if e.File.GoPkg.Path == currentPackage {
+		return name
+	}
+	pkg := e.File.GoPkg.Name
+	if alias := e.File.GoPkg.Alias; alias != "" {
+		pkg = alias
+	}
+	return fmt.Sprintf("%s.%s", pkg, name)
+}
+
+// Service wraps descriptor.ServiceDescriptorProto for richer features.
+type Service struct {
+	// File is the file where this service is defined.
+	File *File
+	*descriptor.ServiceDescriptorProto
+	// Methods is the list of methods defined in this service.
+	Methods []*Method
+}
+
+// FQSN returns the fully qualified service name of this service.
+func (s *Service) FQSN() string {
+	components := []string{""}
+	if s.File.Package != nil {
+		components = append(components, s.File.GetPackage())
+	}
+	components = append(components, s.GetName())
+	return strings.Join(components, ".")
+}
+
+// Method wraps descriptor.MethodDescriptorProto for richer features.
+type Method struct {
+	// Service is the service which this method belongs to.
+	Service *Service
+	*descriptor.MethodDescriptorProto
+
+	// RequestType is the message type of requests to this method.
+	RequestType *Message
+	// ResponseType is the message type of responses from this method.
+	ResponseType *Message
+	Bindings     []*Binding
+}
+
+// FQMN returns a fully qualified rpc method name of this method.
+func (m *Method) FQMN() string {
+	components := []string{}
+	components = append(components, m.Service.FQSN())
+	components = append(components, m.GetName())
+	return strings.Join(components, ".")
+}
+
+// Binding describes how an HTTP endpoint is bound to a gRPC method.
+type Binding struct {
+	// Method is the method which the endpoint is bound to.
+	Method *Method
+	// Index is a zero-origin index of the binding in the target method
+	Index int
+	// PathTmpl is path template where this method is mapped to.
+	PathTmpl httprule.Template
+	// HTTPMethod is the HTTP method which this method is mapped to.
+	HTTPMethod string
+	// PathParams is the list of parameters provided in HTTP request paths.
+	PathParams []Parameter
+	// Body describes parameters provided in HTTP request body.
+	Body *Body
+	// ResponseBody describes field in response struct to marshal in HTTP response body.
+	ResponseBody *Body
+}
+
+// ExplicitParams returns a list of explicitly bound parameters of "b",
+// i.e. a union of field path for body and field paths for path parameters.
+func (b *Binding) ExplicitParams() []string {
+	var result []string
+	if b.Body != nil {
+		result = append(result, b.Body.FieldPath.String())
+	}
+	for _, p := range b.PathParams {
+		result = append(result, p.FieldPath.String())
+	}
+	return result
+}
+
+// Field wraps descriptor.FieldDescriptorProto for richer features.
+type Field struct {
+	// Message is the message type which this field belongs to.
+	Message *Message
+	// FieldMessage is the message type of the field.
+	FieldMessage *Message
+	*descriptor.FieldDescriptorProto
+}
+
+// Parameter is a parameter provided in http requests
+type Parameter struct {
+	// FieldPath is a path to a proto field which this parameter is mapped to.
+	FieldPath
+	// Target is the proto field which this parameter is mapped to.
+	Target *Field
+	// Method is the method which this parameter is used for.
+	Method *Method
+}
+
+// ConvertFuncExpr returns a go expression of a converter function.
+// The converter function converts a string into a value for the parameter.
+func (p Parameter) ConvertFuncExpr() (string, error) {
+	tbl := proto3ConvertFuncs
+	if !p.IsProto2() && p.IsRepeated() {
+		tbl = proto3RepeatedConvertFuncs
+	} else if p.IsProto2() && !p.IsRepeated() {
+		tbl = proto2ConvertFuncs
+	} else if p.IsProto2() && p.IsRepeated() {
+		tbl = proto2RepeatedConvertFuncs
+	}
+	typ := p.Target.GetType()
+	conv, ok := tbl[typ]
+	if !ok {
+		conv, ok = wellKnownTypeConv[p.Target.GetTypeName()]
+	}
+	if !ok {
+		return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName())
+	}
+	return conv, nil
+}
+
+// IsEnum returns true if the field is an enum type, otherwise false is returned.
+func (p Parameter) IsEnum() bool {
+	return p.Target.GetType() == descriptor.FieldDescriptorProto_TYPE_ENUM
+}
+
+// IsRepeated returns true if the field is repeated, otherwise false is returned.
+func (p Parameter) IsRepeated() bool {
+	return p.Target.GetLabel() == descriptor.FieldDescriptorProto_LABEL_REPEATED
+}
+
+// IsProto2 returns true if the field is proto2, otherwise false is returned.
+func (p Parameter) IsProto2() bool {
+	return p.Target.Message.File.proto2()
+}
+
+// Body describes a http (request|response) body to be sent to the (method|client).
+// This is used in body and response_body options in google.api.HttpRule
+type Body struct {
+	// FieldPath is a path to a proto field which the (request|response) body is mapped to.
+	// The (request|response) body is mapped to the (request|response) type itself if FieldPath is empty.
+	FieldPath FieldPath
+}
+
+// AssignableExpr returns an assignable expression in Go to be used to initialize method request object.
+// It starts with "msgExpr", which is the go expression of the method request object.
+func (b Body) AssignableExpr(msgExpr string) string {
+	return b.FieldPath.AssignableExpr(msgExpr)
+}
+
+// FieldPath is a path to a field from a request message.
+type FieldPath []FieldPathComponent
+
+// String returns a string representation of the field path.
+func (p FieldPath) String() string {
+	var components []string
+	for _, c := range p {
+		components = append(components, c.Name)
+	}
+	return strings.Join(components, ".")
+}
+
+// IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path.
+func (p FieldPath) IsNestedProto3() bool {
+	if len(p) > 1 && !p[0].Target.Message.File.proto2() {
+		return true
+	}
+	return false
+}
+
+// AssignableExpr is an assignable expression in Go to be used to assign a value to the target field.
+// It starts with "msgExpr", which is the go expression of the method request object.
+func (p FieldPath) AssignableExpr(msgExpr string) string {
+	l := len(p)
+	if l == 0 {
+		return msgExpr
+	}
+
+	var preparations []string
+	components := msgExpr
+	for i, c := range p {
+		// Check if it is a oneOf field.
+		if c.Target.OneofIndex != nil {
+			index := c.Target.OneofIndex
+			msg := c.Target.Message
+			oneOfName := gogen.CamelCase(msg.GetOneofDecl()[*index].GetName())
+			oneofFieldName := msg.GetName() + "_" + c.AssignableExpr()
+
+			components = components + "." + oneOfName
+			s := `if %s == nil {
+				%s =&%s{}
+			} else if _, ok := %s.(*%s); !ok {
+				return nil, metadata, grpc.Errorf(codes.InvalidArgument, "expect type: *%s, but: %%t\n",%s)
+			}`
+
+			preparations = append(preparations, fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, components))
+			components = components + ".(*" + oneofFieldName + ")"
+		}
+
+		if i == l-1 {
+			components = components + "." + c.AssignableExpr()
+			continue
+		}
+		components = components + "." + c.ValueExpr()
+	}
+
+	preparations = append(preparations, components)
+	return strings.Join(preparations, "\n")
+}
+
+// FieldPathComponent is a path component in FieldPath
+type FieldPathComponent struct {
+	// Name is a name of the proto field which this component corresponds to.
+	// TODO(yugui) is this necessary?
+	Name string
+	// Target is the proto field which this component corresponds to.
+	Target *Field
+}
+
+// AssignableExpr returns an assignable expression in go for this field.
+func (c FieldPathComponent) AssignableExpr() string {
+	return gogen.CamelCase(c.Name)
+}
+
+// ValueExpr returns an expression in go for this field.
+func (c FieldPathComponent) ValueExpr() string {
+	if c.Target.Message.File.proto2() {
+		return fmt.Sprintf("Get%s()", gogen.CamelCase(c.Name))
+	}
+	return gogen.CamelCase(c.Name)
+}
+
+var (
+	proto3ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
+		descriptor.FieldDescriptorProto_TYPE_DOUBLE:  "runtime.Float64",
+		descriptor.FieldDescriptorProto_TYPE_FLOAT:   "runtime.Float32",
+		descriptor.FieldDescriptorProto_TYPE_INT64:   "runtime.Int64",
+		descriptor.FieldDescriptorProto_TYPE_UINT64:  "runtime.Uint64",
+		descriptor.FieldDescriptorProto_TYPE_INT32:   "runtime.Int32",
+		descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64",
+		descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32",
+		descriptor.FieldDescriptorProto_TYPE_BOOL:    "runtime.Bool",
+		descriptor.FieldDescriptorProto_TYPE_STRING:  "runtime.String",
+		// FieldDescriptorProto_TYPE_GROUP
+		// FieldDescriptorProto_TYPE_MESSAGE
+		descriptor.FieldDescriptorProto_TYPE_BYTES:    "runtime.Bytes",
+		descriptor.FieldDescriptorProto_TYPE_UINT32:   "runtime.Uint32",
+		descriptor.FieldDescriptorProto_TYPE_ENUM:     "runtime.Enum",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64",
+		descriptor.FieldDescriptorProto_TYPE_SINT32:   "runtime.Int32",
+		descriptor.FieldDescriptorProto_TYPE_SINT64:   "runtime.Int64",
+	}
+
+	proto3RepeatedConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
+		descriptor.FieldDescriptorProto_TYPE_DOUBLE:  "runtime.Float64Slice",
+		descriptor.FieldDescriptorProto_TYPE_FLOAT:   "runtime.Float32Slice",
+		descriptor.FieldDescriptorProto_TYPE_INT64:   "runtime.Int64Slice",
+		descriptor.FieldDescriptorProto_TYPE_UINT64:  "runtime.Uint64Slice",
+		descriptor.FieldDescriptorProto_TYPE_INT32:   "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64Slice",
+		descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32Slice",
+		descriptor.FieldDescriptorProto_TYPE_BOOL:    "runtime.BoolSlice",
+		descriptor.FieldDescriptorProto_TYPE_STRING:  "runtime.StringSlice",
+		// FieldDescriptorProto_TYPE_GROUP
+		// FieldDescriptorProto_TYPE_MESSAGE
+		descriptor.FieldDescriptorProto_TYPE_BYTES:    "runtime.BytesSlice",
+		descriptor.FieldDescriptorProto_TYPE_UINT32:   "runtime.Uint32Slice",
+		descriptor.FieldDescriptorProto_TYPE_ENUM:     "runtime.EnumSlice",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64Slice",
+		descriptor.FieldDescriptorProto_TYPE_SINT32:   "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_SINT64:   "runtime.Int64Slice",
+	}
+
+	proto2ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
+		descriptor.FieldDescriptorProto_TYPE_DOUBLE:  "runtime.Float64P",
+		descriptor.FieldDescriptorProto_TYPE_FLOAT:   "runtime.Float32P",
+		descriptor.FieldDescriptorProto_TYPE_INT64:   "runtime.Int64P",
+		descriptor.FieldDescriptorProto_TYPE_UINT64:  "runtime.Uint64P",
+		descriptor.FieldDescriptorProto_TYPE_INT32:   "runtime.Int32P",
+		descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64P",
+		descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32P",
+		descriptor.FieldDescriptorProto_TYPE_BOOL:    "runtime.BoolP",
+		descriptor.FieldDescriptorProto_TYPE_STRING:  "runtime.StringP",
+		// FieldDescriptorProto_TYPE_GROUP
+		// FieldDescriptorProto_TYPE_MESSAGE
+		// FieldDescriptorProto_TYPE_BYTES
+		// TODO(yugui) Handle bytes
+		descriptor.FieldDescriptorProto_TYPE_UINT32:   "runtime.Uint32P",
+		descriptor.FieldDescriptorProto_TYPE_ENUM:     "runtime.EnumP",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32P",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64P",
+		descriptor.FieldDescriptorProto_TYPE_SINT32:   "runtime.Int32P",
+		descriptor.FieldDescriptorProto_TYPE_SINT64:   "runtime.Int64P",
+	}
+
+	proto2RepeatedConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
+		descriptor.FieldDescriptorProto_TYPE_DOUBLE:  "runtime.Float64Slice",
+		descriptor.FieldDescriptorProto_TYPE_FLOAT:   "runtime.Float32Slice",
+		descriptor.FieldDescriptorProto_TYPE_INT64:   "runtime.Int64Slice",
+		descriptor.FieldDescriptorProto_TYPE_UINT64:  "runtime.Uint64Slice",
+		descriptor.FieldDescriptorProto_TYPE_INT32:   "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64Slice",
+		descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32Slice",
+		descriptor.FieldDescriptorProto_TYPE_BOOL:    "runtime.BoolSlice",
+		descriptor.FieldDescriptorProto_TYPE_STRING:  "runtime.StringSlice",
+		// FieldDescriptorProto_TYPE_GROUP
+		// FieldDescriptorProto_TYPE_MESSAGE
+		// FieldDescriptorProto_TYPE_BYTES
+		// TODO(maros7) Handle bytes
+		descriptor.FieldDescriptorProto_TYPE_UINT32:   "runtime.Uint32Slice",
+		descriptor.FieldDescriptorProto_TYPE_ENUM:     "runtime.EnumSlice",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64Slice",
+		descriptor.FieldDescriptorProto_TYPE_SINT32:   "runtime.Int32Slice",
+		descriptor.FieldDescriptorProto_TYPE_SINT64:   "runtime.Int64Slice",
+	}
+
+	wellKnownTypeConv = map[string]string{
+		".google.protobuf.Timestamp":   "runtime.Timestamp",
+		".google.protobuf.Duration":    "runtime.Duration",
+		".google.protobuf.StringValue": "runtime.StringValue",
+		".google.protobuf.FloatValue":  "runtime.FloatValue",
+		".google.protobuf.DoubleValue": "runtime.DoubleValue",
+		".google.protobuf.BoolValue":   "runtime.BoolValue",
+		".google.protobuf.BytesValue":  "runtime.BytesValue",
+		".google.protobuf.Int32Value":  "runtime.Int32Value",
+		".google.protobuf.UInt32Value": "runtime.UInt32Value",
+		".google.protobuf.Int64Value":  "runtime.Int64Value",
+		".google.protobuf.UInt64Value": "runtime.UInt64Value",
+	}
+)