proto library Client - Class FileDescriptorProto (v5.36.2)

Reference documentation and code samples for the proto library Client class FileDescriptorProto.

Describes a complete .proto file.

Generated from protobuf message google.protobuf.FileDescriptorProto

Namespace

Google \ Protobuf \ Internal

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ name string

file name, relative to root of source tree

↳ package string

e.g. "foo", "foo.bar", etc.

↳ dependency string[]

Names of files imported by this file.

↳ public_dependency int[]

Indexes of the public imported files in the dependency list above.

↳ weak_dependency int[]

Indexes of the weak imported files in the dependency list. For Google-internal migration only. Do not use.

↳ option_dependency string[]

Names of files imported by this file purely for the purpose of providing option extensions. These are excluded from the dependency list above.

↳ message_type array<DescriptorProto>

All top-level definitions in this file.

↳ enum_type array<EnumDescriptorProto>
↳ service array<ServiceDescriptorProto>
↳ extension array<FieldDescriptorProto>
↳ options FileOptions
↳ source_code_info SourceCodeInfo

This field contains optional information about the original source code. You may safely remove this entire field without harming runtime functionality of the descriptors -- the information is needed only by development tools.

↳ syntax string

The syntax of the proto file. The supported values are "proto2", "proto3", and "editions". If edition is present, this value must be "editions". WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

↳ edition int

The edition of the proto file. WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

getName

file name, relative to root of source tree

Returns
Type Description
string

hasName

clearName

setName

file name, relative to root of source tree

Parameter
Name Description
var string
Returns
Type Description
$this

getPackage

e.g. "foo", "foo.bar", etc.

Returns
Type Description
string

hasPackage

clearPackage

setPackage

e.g. "foo", "foo.bar", etc.

Parameter
Name Description
var string
Returns
Type Description
$this

getDependency

Names of files imported by this file.

Returns
Type Description
Google\Protobuf\RepeatedField<string>

setDependency

Names of files imported by this file.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getPublicDependency

Indexes of the public imported files in the dependency list above.

Returns
Type Description
Google\Protobuf\RepeatedField<int>

setPublicDependency

Indexes of the public imported files in the dependency list above.

Parameter
Name Description
var int[]
Returns
Type Description
$this

getWeakDependency

Indexes of the weak imported files in the dependency list.

For Google-internal migration only. Do not use.

Returns
Type Description
Google\Protobuf\RepeatedField<int>

setWeakDependency

Indexes of the weak imported files in the dependency list.

For Google-internal migration only. Do not use.

Parameter
Name Description
var int[]
Returns
Type Description
$this

getOptionDependency

Names of files imported by this file purely for the purpose of providing option extensions. These are excluded from the dependency list above.

Returns
Type Description
Google\Protobuf\RepeatedField<string>

setOptionDependency

Names of files imported by this file purely for the purpose of providing option extensions. These are excluded from the dependency list above.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getMessageType

All top-level definitions in this file.

Returns
Type Description
Google\Protobuf\RepeatedField<DescriptorProto>

setMessageType

All top-level definitions in this file.

Parameter
Name Description
var array<DescriptorProto>
Returns
Type Description
$this

getEnumType

Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5;

Returns
Type Description
Google\Protobuf\RepeatedField<EnumDescriptorProto>

setEnumType

Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5;

Parameter
Name Description
var array<EnumDescriptorProto>
Returns
Type Description
$this

getService

Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6;

Returns
Type Description
Google\Protobuf\RepeatedField<ServiceDescriptorProto>

setService

Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6;

Parameter
Name Description
var array<ServiceDescriptorProto>
Returns
Type Description
$this

getExtension

Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7;

Returns
Type Description
Google\Protobuf\RepeatedField<FieldDescriptorProto>

setExtension

Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7;

Parameter
Name Description
var array<FieldDescriptorProto>
Returns
Type Description
$this

getOptions

Generated from protobuf field optional .google.protobuf.FileOptions options = 8;

Returns
Type Description
FileOptions|null

hasOptions

clearOptions

setOptions

Generated from protobuf field optional .google.protobuf.FileOptions options = 8;

Parameter
Name Description
var FileOptions
Returns
Type Description
$this

getSourceCodeInfo

This field contains optional information about the original source code.

You may safely remove this entire field without harming runtime functionality of the descriptors -- the information is needed only by development tools.

Returns
Type Description
SourceCodeInfo|null

hasSourceCodeInfo

clearSourceCodeInfo

setSourceCodeInfo

This field contains optional information about the original source code.

You may safely remove this entire field without harming runtime functionality of the descriptors -- the information is needed only by development tools.

Parameter
Name Description
var SourceCodeInfo
Returns
Type Description
$this

getSyntax

The syntax of the proto file.

The supported values are "proto2", "proto3", and "editions". If edition is present, this value must be "editions". WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

Returns
Type Description
string

hasSyntax

clearSyntax

setSyntax

The syntax of the proto file.

The supported values are "proto2", "proto3", and "editions". If edition is present, this value must be "editions". WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

Parameter
Name Description
var string
Returns
Type Description
$this

getEdition

The edition of the proto file.

WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

Returns
Type Description
int one of the values in {@see \Google\Protobuf\Internal\Edition}

hasEdition

clearEdition

setEdition

The edition of the proto file.

WARNING: This field should only be used by protobuf plugins or special cases like the proto compiler. Other uses are discouraged and developers should rely on the protoreflect APIs for their client language.

Parameter
Name Description
var int

one of the values in Edition

Returns
Type Description
$this