BoundedAuthorityProtocol.V1.Json (Bounded Authority Protocol v0.1.1)

Copy Markdown View Source

Bounded JSON decoder preserving object order and rejecting duplicate binary names.

decode/2 returns the tagged, closed v1 algebra documented by value/0; it never atomizes an input name. Raw numeric lexemes are byte-bounded and exact-magnitude-checked before OTP conversion. Caller limits may only tighten the positive-integer hard maxima. Every failure is the fixed value-free {:error, :invalid}.

Draft 2020-12 schemas shipped with the package describe structural shape. They do not replace this decoder's duplicate-name, raw-lexeme, UTF-8 byte, depth, node, or exact encoding checks.

Summary

Types

Closed v1 JSON value algebra.

Functions

Decodes one complete bounded JSON value.

Types

value()

@type value() ::
  :null
  | {:boolean, boolean()}
  | {:integer, integer()}
  | {:float, float()}
  | {:string, binary()}
  | {:array, [value()]}
  | {:object, [{binary(), value()}]}

Closed v1 JSON value algebra.

Functions

decode(bytes, limits \\ %{})

@spec decode(binary(), BoundedAuthorityProtocol.V1.Bounds.t() | map()) ::
  {:ok, value()} | {:error, :invalid}

Decodes one complete bounded JSON value.