Default
Default
In-browser search
Settings
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.
:unknown_fields means the same everywhere: on encode, how map keys the
message does not define are handled; on JSON and text format decode, how fields
in the input the message does not define are handled. Binary decode always
keeps unknown fields, as protobuf requires.
Option Values Default Notes :projectionslist of {fqn, opts} []Message-level adapters and structural representation. See below. :pluginslist of module | {module, opts} []PB.Schema.Plugin s that compile their own data into the schema, such as PB.Validate .:allow_missing_importsbooleanfalseCompile a descriptor set that lacks some of the files its files import, leaving the options they define undecoded. See Missing imports .
Each :projections entry pairs a fully-qualified message name with a keyword
list. adapter: is mutually exclusive with the structural keys:
Key Values Notes 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 .
Option Values Default Notes :unknown_fields:error | :ignore:errorHow unknown map keys are handled.
Option Values Default Notes :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)Option Values Default :emit_defaultsbooleanfalse:use_proto_namesbooleanfalse:enums_as_intsbooleanfalse:unknown_fields:error | :ignore:error
PB.JSON decode (decode/4, from_term/4)Option Values Default :unknown_fields:error | :ignore:error
:ignore also skips enum strings the enum does not declare.
Option Values Default :unknown_fields:error | :ignore:error:allow_field_numbersbooleanfalse
PB.TextFormat encode (encode/4, encode_iodata/4)Option Values Default :unknown_fields:error | :ignore:error:single_linebooleanfalse:short_repeatedbooleanfalse:print_unknown_fieldsbooleantrue
use PB.Schema accepts :projections, :plugins and :allow_missing_imports
with the same meaning.