OpenPayments.Types.Subject (open_payments_elixir v1.0.0)

Copy Markdown View Source

Subject information requested or returned by an authorization server.

The pinned schema requires sub_ids to contain exactly one typed SubjectIdentifier. Missing, null, empty and multi-entry arrays are invalid. Additional JSON fields are retained in extensions. The wire name remains sub_ids; no camel-case alias is substituted.

Inspection omits subject values and extensions; explicit map/JSON exports contain them. This data codec makes no requests and does not verify identity. Validate manually constructed or modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes a subject object and its single identifier without resolving it.

Converts to protocol fields, including subject identifiers, without validating.

Revalidates the single typed subject identifier and root extension fields.

Types

t()

@type t() :: %OpenPayments.Types.Subject{
  extensions: %{optional(String.t()) => term()},
  sub_ids: [OpenPayments.Types.SubjectIdentifier.t()]
}

Functions

from_map(data)

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

Decodes a subject object and its single identifier without resolving it.

to_map(subject)

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

Converts to protocol fields, including subject identifiers, without validating.

validate(subject)

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

Revalidates the single typed subject identifier and root extension fields.