A consolidated list of the options each public entry point accepts. Unknown options are rejected (they raise or return a PB.OptionError) rather than being silently ignored.

PB.compile/2

OptionValuesDefaultNotes
:projectionslist of {fqn, opts}[]Message-level adapters and structural representation. See below.

Each :projections entry pairs a fully-qualified message name with a keyword list. adapter: is mutually exclusive with the structural keys:

KeyValuesNotes
adapter:%PB.Adapter{}App/proto conversion spec.
struct:ModuleProject the message to a struct.
unwrap:field_name | trueProject to the single field's value.
preserved_unknown_fields::drop | :reject | {:field, atom}Unknown-field policy (struct/unwrap). Default :drop.
extensions::reject | {:field, atom}Extension policy (struct). Default :reject.
oneofs:[{oneof_name, [representation: :identity]}]Identity-projected oneofs.

See Decoding into structs and Adapters and well-known types.

PB.encode/4 / PB.encode!/4 / PB.encode_iodata/4

OptionValuesDefaultNotes
:unknown_fields:error | :ignore:errorHow unknown map keys are handled.

PB.decode/4 / PB.decode!/4

OptionValuesDefaultNotes
:defaultsbooleanfalsePopulate missing scalar/enum/repeated/map fields with proto3 defaults. Singular messages and oneofs are never populated.
:message_namesnil | :rootnilAnnotate the root decoded map with :__message_name__.

PB.JSON encode (encode/4, encode_iodata/4, to_term/4)

OptionValuesDefault
:emit_defaultsbooleanfalse
:use_proto_namesbooleanfalse
:enums_as_intsbooleanfalse

PB.JSON decode (decode/4, from_term/4)

OptionValuesDefault
:ignore_unknownbooleanfalse

PB.Validate.validate/4

OptionValuesNotes
:contextkeyword | map | %PB.Validate.Context{}Runtime context for CEL evaluation.
:now{:timestamp, unix_nanoseconds}Value bound to the now variable in CEL rules.