OmniBuf.Blind (omnibuf v0.1.0)

Copy Markdown View Source

Tier 4: Schema-less OmniBuf packet decoding (OmniBuf.Blind.decode/1 and OmniBuf.Blind.decode_json/1).

Decodes any OmniBuf v0.1 packet into JSON-ready Elixir maps, resolving Field #0 (OmniBuf.SchemaMeta) names across nested submessages, arrays, and maps, and falling back to "field_<N>" for unnamed fields.

Summary

Functions

Decodes an OmniBuf binary without a schema into a map keyed by Field #0 names or "field_<N>".

Decodes an OmniBuf binary without a schema and encodes the result as a JSON string. WireBytes values are encoded as standard RFC 4648 Base64 strings.

Functions

decode(bin, opts \\ [])

@spec decode(binary(), keyword()) :: {:ok, map()} | {:error, OmniBuf.Error.t()}

Decodes an OmniBuf binary without a schema into a map keyed by Field #0 names or "field_<N>".

Options:

  • :inherited_schema - optional %OmniBuf.SchemaMeta{}
  • :max_depth - max container depth (default 32, capped at 32)
  • :max_elements - max cumulative collection elements (default 4_194_304)
  • :max_message_bytes - max packet byte size (default 64 MiB)

decode_json(bin, opts \\ [])

@spec decode_json(binary(), keyword()) ::
  {:ok, String.t()} | {:error, OmniBuf.Error.t()}

Decodes an OmniBuf binary without a schema and encodes the result as a JSON string. WireBytes values are encoded as standard RFC 4648 Base64 strings.