Documentation ¶
Index ¶
- type SerializableTypes
- func BuildDynamicTypeRegistry(ctx context.Context, protoDir string, provider fs.Provider) (*SerializableTypes, error)
- func BuildDynamicTypeRegistryFromBufImage(image []byte) (*SerializableTypes, error)
- func NewSerializableTypes() *SerializableTypes
- func ReBuildDynamicTypeRegistry(ctx context.Context, protoDir string, useExternalTypes bool, ...) (*SerializableTypes, error)
- func RegisterDynamicTypes(files *protoregistry.Files) (*SerializableTypes, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SerializableTypes ¶
type SerializableTypes struct { Types *protoregistry.Types FileDescriptorSet *descriptorpb.FileDescriptorSet }
Wrapper around a user-defined registry that allows it to be serialized. Under the hood, the go-native types and the file descriptor set are kept in-sync. If types are registered in one, they are added to the serializable object as well. FileDescriptorSet is a protobuf object that can be serialized and shared with external systems (e.g. the frontend)
func BuildDynamicTypeRegistry ¶
func BuildDynamicTypeRegistry(ctx context.Context, protoDir string, provider fs.Provider) (*SerializableTypes, error)
Takes a path to the protobuf directory in the config repo, and generates a registry of user-defined types. This registry implements the Resolver interface, which is useful for compiling to json.
func BuildDynamicTypeRegistryFromBufImage ¶
func BuildDynamicTypeRegistryFromBufImage(image []byte) (*SerializableTypes, error)
func NewSerializableTypes ¶
func NewSerializableTypes() *SerializableTypes
func ReBuildDynamicTypeRegistry ¶
func ReBuildDynamicTypeRegistry(ctx context.Context, protoDir string, useExternalTypes bool, cw fs.ConfigWriter) (*SerializableTypes, error)
Note: this method is not safe to be run on ephemeral repos, as it invokes the buf cmd line.
func RegisterDynamicTypes ¶
func RegisterDynamicTypes(files *protoregistry.Files) (*SerializableTypes, error)
func (*SerializableTypes) AddFileDescriptor ¶
func (st *SerializableTypes) AddFileDescriptor(fd protoreflect.FileDescriptor, checkNotExists bool) error