ProtoConfig

Available in a dev version: 0․11․0-grpc-186

How to configure

class ProtoConfig(val discardUnknownFields: Boolean = false, val recursionLimit: Int = DEFAULT_RECURSION_LIMIT, val extensionRegistry: ProtoExtensionRegistry? = null) : GrpcMarshallerConfig(source)

Configuration options for Protobuf message encoding and decoding.

This class implements GrpcMarshallerConfig to provide Protobuf-specific configuration that controls how messages are serialized and deserialized when using Protobuf marshallers generated from .proto files using kotlinx-rpc.

Example:

// Create a marshaller with custom config
val config = ProtoConfig(discardUnknownFields = true)
val myMarshaller = grpcMarshallerOf<MyMessage>(config)

// Or pass config per-operation
val decoded = marshaller.decode(stream, config)

See also

Constructors

Link copied to clipboard
constructor(discardUnknownFields: Boolean = false, recursionLimit: Int = DEFAULT_RECURSION_LIMIT, extensionRegistry: ProtoExtensionRegistry? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

When true, unknown fields encountered during deserialization are silently discarded. When false (default), unknown fields are preserved.

Link copied to clipboard

Registry of known protobuf extensions used during decoding. If set, extension fields matching registered descriptors are decoded. If null (default), extension fields are treated as unknown fields.

Link copied to clipboard

The maximum allowed nesting depth when decoding protobuf messages. Messages nested deeper than this limit will cause a kotlinx.rpc.protobuf.internal.ProtobufDecodingException. Defaults to DEFAULT_RECURSION_LIMIT (100), matching Google's protobuf default.