Spikard.ProblemDetails (spikard v0.15.6-rc.6)

Copy Markdown

RFC 9457 Problem Details for HTTP APIs

A machine-readable format for specifying errors in HTTP API responses. Per RFC 9457, all fields are optional. The type field defaults to "about:blank" if not specified.

Content-Type

Responses using this struct should set:

Content-Type: application/problem+json
{
  "type": "https://spikard.dev/errors/validation-error",
  "title": "Request Validation Failed",
  "status": 422,
  "detail": "2 validation errors in request body",
  "errors": [...]
}

Summary

Types

t()

RFC 9457 Problem Details for HTTP APIs

Types

t()

@type t() :: %Spikard.ProblemDetails{
  detail: String.t() | nil,
  extensions: map(),
  instance: String.t() | nil,
  status: non_neg_integer(),
  title: String.t() | nil,
  type_uri: String.t() | nil
}

RFC 9457 Problem Details for HTTP APIs