OpenPayments.Types.SubjectIdentifier (open_payments_elixir v1.0.0)

Copy Markdown View Source

A subject identifier requested or returned in a grant's subject information.

The pinned schema requires an id string and the format discriminator uri. The id property itself has no URI format/pattern constraint, so this codec checks its string type without imposing wallet discovery or request URL rules. Additional JSON fields are retained in extensions.

Inspection omits the identifier and extensions. Explicit map/JSON export includes them. This type does not resolve a wallet, verify identity, or make requests. Validate manually constructed or modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes a subject identifier without interpreting or resolving its value.

Converts to protocol fields, including the identifier, without validating.

Validates the identifier, format discriminator and permitted extension data.

Types

t()

@type t() :: %OpenPayments.Types.SubjectIdentifier{
  extensions: %{optional(String.t()) => term()},
  format: String.t(),
  id: String.t()
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes a subject identifier without interpreting or resolving its value.

to_map(identifier)

@spec to_map(t()) :: map()

Converts to protocol fields, including the identifier, without validating.

validate(identifier)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Validates the identifier, format discriminator and permitted extension data.