Skip to main content

Class: FileDescriptorProto

Describes a complete .proto file.

Properties​

dependency​

dependency: string[]

Names of files imported by this file.


edition​

edition: Edition

The edition of the proto file.


enumType​

enumType: $Properties[]

FileDescriptorProto enumType.


extension​

extension: $Properties[]

FileDescriptorProto extension.


messageType​

messageType: $Properties[]

All top-level definitions in this file.


name​

name: string

file name, relative to root of source tree


options?​

optional options?: $Properties | null

FileDescriptorProto options.


package​

package: string

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


publicDependency​

publicDependency: number[]

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


service​

service: $Properties[]

FileDescriptorProto service.


sourceCodeInfo?​

optional sourceCodeInfo?: $Properties | null

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​

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".


weakDependency​

weakDependency: number[]

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

Methods​

toJSON()​

toJSON(): object

Converts this FileDescriptorProto to JSON.

Returns​

object

JSON object


create()​

Call Signature​

static create(properties?): FileDescriptorProto & $Shape

Creates a new FileDescriptorProto instance using the specified properties.

Parameters​
properties?​

$Shape

Properties to set

Returns​

FileDescriptorProto & $Shape

FileDescriptorProto instance

Call Signature​

static create(properties?): FileDescriptorProto

Creates a new FileDescriptorProto instance using the specified properties.

Parameters​
properties?​

$Properties

Properties to set

Returns​

FileDescriptorProto

FileDescriptorProto instance


decode()​

static decode(reader, length?): FileDescriptorProto & $Shape

Decodes a FileDescriptorProto message from the specified reader or buffer.

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

length?​

number

Message length if known beforehand

Returns​

FileDescriptorProto & $Shape

FileDescriptorProto

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


decodeDelimited()​

static decodeDelimited(reader): FileDescriptorProto & $Shape

Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited.

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

Returns​

FileDescriptorProto & $Shape

FileDescriptorProto

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


encode()​

static encode(message, writer?): Writer

Encodes the specified FileDescriptorProto message. Does not implicitly google.protobuf.FileDescriptorProto.verify|verify messages.

Parameters​

message​

$Properties

FileDescriptorProto message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


encodeDelimited()​

static encodeDelimited(message, writer?): Writer

Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly google.protobuf.FileDescriptorProto.verify|verify messages.

Parameters​

message​

$Properties

FileDescriptorProto message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


fromObject()​

static fromObject(object): FileDescriptorProto

Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types.

Parameters​

object​

{[k: string]: any; }

Plain object

Returns​

FileDescriptorProto

FileDescriptorProto


toObject()​

static toObject(message, options?): object

Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified.

Parameters​

message​

FileDescriptorProto

FileDescriptorProto

options?​

IConversionOptions

Conversion options

Returns​

object

Plain object