const ( SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2 SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023 )
func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error)
NewFile creates a new protoreflect.FileDescriptor from the provided file descriptor message. See FileOptions.New for more information.
func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error)
NewFiles creates a new protoregistry.Files from the provided FileDescriptorSet message. See FileOptions.NewFiles for more information.
func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto
ToDescriptorProto copies a protoreflect.MessageDescriptor into a google.protobuf.DescriptorProto message.
func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto
ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a google.protobuf.EnumDescriptorProto message.
func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto
ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a google.protobuf.EnumValueDescriptorProto message.
func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto
ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a google.protobuf.FieldDescriptorProto message.
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto
ToFileDescriptorProto copies a protoreflect.FileDescriptor into a google.protobuf.FileDescriptorProto message.
func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto
ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a google.protobuf.MethodDescriptorProto message.
func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto
ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a google.protobuf.OneofDescriptorProto message.
func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto
ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a google.protobuf.ServiceDescriptorProto message.
FileOptions configures the construction of file descriptors.
type FileOptions struct { pragma.NoUnkeyedLiterals // AllowUnresolvable configures New to permissively allow unresolvable // file, enum, or message dependencies. Unresolved dependencies are replaced // by placeholder equivalents. // // The following dependencies may be left unresolved: // • Resolving an imported file. // • Resolving the type for a message field or extension field. // If the kind of the field is unknown, then a placeholder is used for both // the Enum and Message accessors on the protoreflect.FieldDescriptor. // • Resolving an enum value set as the default for an optional enum field. // If unresolvable, the protoreflect.FieldDescriptor.Default is set to the // first value in the associated enum (or zero if the also enum dependency // is also unresolvable). The protoreflect.FieldDescriptor.DefaultEnumValue // is populated with a placeholder. // • Resolving the extended message type for an extension field. // • Resolving the input or output message type for a service method. // // If the unresolved dependency uses a relative name, // then the placeholder will contain an invalid FullName with a "*." prefix, // indicating that the starting prefix of the full name is unknown. AllowUnresolvable bool }
func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error)
New creates a new protoreflect.FileDescriptor from the provided file descriptor message. The file must represent a valid proto file according to protobuf semantics. The returned descriptor is a deep copy of the input.
Any imported files, enum types, or message types referenced in the file are resolved using the provided registry. When looking up an import file path, the path must be unique. The newly created file descriptor is not registered back into the provided file registry.
func (o FileOptions) NewFiles(fds *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error)
NewFiles creates a new protoregistry.Files from the provided FileDescriptorSet message. The descriptor set must include only valid files according to protobuf semantics. The returned descriptors are a deep copy of the input.
Resolver is the resolver used by NewFile to resolve dependencies. The enums and messages provided must belong to some parent file, which is also registered.
It is implemented by protoregistry.Files.
type Resolver interface { FindFileByPath(string) (protoreflect.FileDescriptor, error) FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error) }