From 326e1d5a1422bf9ab1d920d4c614b82c36ee184d Mon Sep 17 00:00:00 2001 From: Etienne Carriere <142815858+ecdatadog@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:28:35 +0100 Subject: [PATCH] Add "prev" field in Link attribute (#60) * Add "prev" field in Link attribute * Update comment following Chris's comment --- jsonapi.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 83e1cab..28240af 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -75,15 +75,17 @@ type LinkObject struct { } // Link is the top-level links object as defined by https://jsonapi.org/format/1.0/#document-top-level. -// First|Last|Next|Previous are provided to support pagination as defined by https://jsonapi.org/format/1.0/#fetching-pagination. +// First|Last|Next|Prev are provided to support pagination as defined by https://jsonapi.org/format/1.0/#fetching-pagination. type Link struct { Self any `json:"self,omitempty"` Related any `json:"related,omitempty"` - First string `json:"first,omitempty"` - Last string `json:"last,omitempty"` - Next string `json:"next,omitempty"` + First string `json:"first,omitempty"` + Last string `json:"last,omitempty"` + Next string `json:"next,omitempty"` + // Previous is deprecated and kept for backwards compatibility. Instead, use the Prev field. Previous string `json:"previous,omitempty"` + Prev string `json:"prev,omitempty"` } func checkLinkValue(linkValue any) (bool, *TypeError) {