Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions L43-node-type-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,25 @@ The object structure for representing Protobuf message types will be as follows:

```ts
{
format: "Protocol Buffer 3 DescriptorProto",
type: DescriptorProtoObject,
fileDescriptorProtos: Buffer[]
format: "Protocol Buffer 3 DescriptorProto";
type: DescriptorProtoObject;
fileDescriptorProtos: Buffer[];
serialize: (message: InputType) => Buffer;
deserialize: (serializedMessage: Buffer) => OutputType;
}
```

A `DescriptorProtoObject` is a plain JavaScript object that contains the [canonical JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json) representation of a `DescriptorProto` message defined in the well known proto file `descriptor.proto`. The `fileDescriptorProtos` array contains a list of `.proto` files that is sufficient to fully define this message type, represented as serialized `FileDescriptorProto` messages defined in the same proto file `descriptor.proto`. The primary purpose of this field is to be used in implementing the gRPC reflection API.
A `DescriptorProtoObject` is a plain JavaScript object that contains the [canonical JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json) representation of a `DescriptorProto` message defined in the well known proto file `descriptor.proto`. The `fileDescriptorProtos` array contains a list of `.proto` files that is sufficient to fully define this message type, represented as serialized `FileDescriptorProto` messages defined in the same proto file `descriptor.proto`. The primary purpose of this field is to be used in implementing the gRPC reflection API.The `serialize` and `deserialize` methods convert between `Buffer` objects and the corresponding input and output types that would be accepted and provided by methods generated by this library.

Protobuf enum types will be represented with a nearly identical structure, except with `EnumDescriptorProto` instead of `DescriptorProto`.
Protobuf enum types will be represented with a similar structure:

```ts
{
format: "Protocol Buffer 3 EnumDescriptorProto";
type: DescriptorProtoObject;
fileDescriptorProtos: Buffer[];
}
```

### `@grpc/proto-loader` type output

Expand Down