Native Elixir serialization for generated Skir schemas.
Non-bang functions return {:ok, value} or {:error, %Skir.Error{}}.
Bang functions raise Skir.Error. encode/3 produces framed Skir binary;
encode_json/3 produces a UTF-8 JSON string. to_json/3 returns a JSON term.
Unknown fields are discarded by default. With unknown_fields: :preserve, they
round-trip in their original format; changing formats then returns an error.
Enable preservation only for trusted data.
No atom is created from untrusted input. SkirRPC lives under Skir.RPC.
Summary
Functions
Decodes framed Skir binary or JSON bytes, validating the input and enforcing resource limits.
Like decode/3, but returns the value directly and raises Skir.Error on failure.
Decodes a UTF-8 JSON string, accepting dense and readable JSON and enforcing resource limits.
Like decode_json/3, but returns the value directly and raises Skir.Error on failure.
Returns the zero/default value for a primitive, composite, or generated record type.
Encodes a value as Skir binary with the skir prefix. This is not Erlang external-term format.
Like encode/3, but returns the value directly and raises Skir.Error on failure.
Encodes a value as a UTF-8 JSON string. Dense JSON is the default; use format: :readable for debugging.
Like encode_json/3, but returns the value directly and raises Skir.Error on failure.
Decodes a dense or readable JSON term. Unknown fields are discarded by default.
Like from_json/3, but returns the value directly and raises Skir.Error on failure.
Build an index for a keyed array. Duplicate keys raise rather than silently overwriting.
Converts a native value to a dense JSON term, or readable JSON with format: :readable.
Like to_json/3, but returns the value directly and raises Skir.Error on failure.
Types
@type primitive() ::
:bool
| :int32
| :int64
| :hash64
| :float32
| :float64
| :timestamp
| :string
| :bytes
@type result(value) :: {:ok, value} | {:error, Skir.Error.t()}
Functions
Decodes framed Skir binary or JSON bytes, validating the input and enforcing resource limits.
Like decode/3, but returns the value directly and raises Skir.Error on failure.
Decodes a UTF-8 JSON string, accepting dense and readable JSON and enforcing resource limits.
Like decode_json/3, but returns the value directly and raises Skir.Error on failure.
Returns the zero/default value for a primitive, composite, or generated record type.
Encodes a value as Skir binary with the skir prefix. This is not Erlang external-term format.
Like encode/3, but returns the value directly and raises Skir.Error on failure.
Encodes a value as a UTF-8 JSON string. Dense JSON is the default; use format: :readable for debugging.
Like encode_json/3, but returns the value directly and raises Skir.Error on failure.
Decodes a dense or readable JSON term. Unknown fields are discarded by default.
Like from_json/3, but returns the value directly and raises Skir.Error on failure.
Build an index for a keyed array. Duplicate keys raise rather than silently overwriting.
Converts a native value to a dense JSON term, or readable JSON with format: :readable.
Like to_json/3, but returns the value directly and raises Skir.Error on failure.