AgentBlueprintProtocol.Bounds (Agent Blueprint Protocol v1.1.0)

Copy Markdown View Source

This module defines limits for JSON decoding and canonical encoding.

Use it when an application needs tighter parse limits than the package profile.

This module does not authorize operations.

Example

{:ok, bounds} = AgentBlueprintProtocol.Bounds.new(%{bytes: 100_000})

Summary

Types

t()

The public data type for AgentBlueprintProtocol.Bounds.

Functions

Validates and normalizes a parse-limit value.

Returns the maximum parse-limit profile.

Builds and validates a value from the supplied options.

Types

t()

(since 1.0.0)
@type t() :: %AgentBlueprintProtocol.Bounds{
  bytes: pos_integer(),
  depth: pos_integer(),
  items: pos_integer(),
  key: pos_integer(),
  members: pos_integer(),
  nodes: pos_integer(),
  number_lexeme: pos_integer(),
  string: pos_integer()
}

The public data type for AgentBlueprintProtocol.Bounds.

Functions

coerce(bounds)

(since 1.0.0)
@spec coerce(t() | map()) :: {:ok, t()} | {:error, AgentBlueprintProtocol.Error.t()}

Validates and normalizes a parse-limit value.

Example

iex> match?({:ok, %AgentBlueprintProtocol.Bounds{bytes: 100}}, AgentBlueprintProtocol.Bounds.coerce(%{bytes: 100}))
true

maximum()

(since 1.0.0)
@spec maximum() :: t()

Returns the maximum parse-limit profile.

Example

iex> is_struct(AgentBlueprintProtocol.Bounds.maximum(), AgentBlueprintProtocol.Bounds)
true

new(overrides)

(since 1.0.0)
@spec new(map()) :: {:ok, t()} | {:error, AgentBlueprintProtocol.Error.t()}

Builds and validates a value from the supplied options.

Example

iex> match?({:ok, %AgentBlueprintProtocol.Bounds{bytes: 100}}, AgentBlueprintProtocol.Bounds.new(%{bytes: 100}))
true