From 69f6e8475e512ed21b455355d0d4fe9c99fe4c82 Mon Sep 17 00:00:00 2001 From: Gonzalo <456459+grzuy@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:54:21 -0300 Subject: [PATCH] fix(paginator): spec-compliant links typespec Per the spec, pagination links can be omitted https://jsonapi.org/format/#fetching-pagination > Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable. --- lib/jsonapi/paginator.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jsonapi/paginator.ex b/lib/jsonapi/paginator.ex index 83bba4d9..d5311dab 100644 --- a/lib/jsonapi/paginator.ex +++ b/lib/jsonapi/paginator.ex @@ -12,10 +12,10 @@ defmodule JSONAPI.Paginator do @type params :: %{String.t() => String.t()} @type links :: %{ - first: String.t() | nil, - last: String.t() | nil, - next: String.t() | nil, - prev: String.t() | nil + optional(:first) => String.t() | nil, + optional(:last) => String.t() | nil, + optional(:next) => String.t() | nil, + optional(:prev) => String.t() | nil } @callback paginate(data :: term, view :: atom, conn :: Conn.t(), page, options) :: links