PB.Schema.Info (PB v0.1.0)

Copy Markdown View Source

Public introspection structs returned by PB.Schema.fetch_message/2 and friends.

These structs are a stable, intentionally narrow projection of the internal compiled schema. Callers should branch off the public structs rather than reading schema.messages directly: the internal compiled representation may grow new fields or change shape as the runtime evolves.

Field types

%PB.Schema.Info.Field{}.type is a tagged tuple:

  • {:scalar, scalar} where scalar is one of :double, :float, :int32, :int64, :uint32, :uint64, :sint32, :sint64, :fixed32, :fixed64, :sfixed32, :sfixed64, :bool, :string, :bytes.
  • {:message, message_name} — a message reference.
  • {:enum, enum_name} — an enum reference.
  • {:map, key_type, value_type} — only emitted when field.cardinality == :map; key_type and value_type are themselves tagged tuples following the same shape.