Closed
Description
The proto.MessageType
and proto.GetProperties
functions can, together, be used to introspect the fields available to a protobuf message type identified by name. This request is for corresponding functionality that operates at the level of protobuf packages.
syntax = "proto3";
package k8s.io.some.package;
message SomeMessage { ... }
message OtherMessage { ... }
The API doesn't need to be very complex, just enough to figure out which messages are available:
type Package struct {
Name string // "k8s.io.some.package"
}
func (*Package) MessageTypes() []reflect.Type
// []string{"k8s.io.some.package.SomeMessage", "k8s.io.some.package.OtherMessage"}
func (*Package) MessageNames() []string
Use case: I want to add type safety to an existing protobuf-compatible config system. The user-visible behavior and error messages will be much more pleasant if the code can introspect the set of messages available to a named Protobuf package.
Metadata
Metadata
Assignees
Labels
No labels