Skip to content

Commit

Permalink
Add "prev" field in Link attribute (#60)
Browse files Browse the repository at this point in the history
* Add "prev" field in Link attribute

* Update comment following Chris's comment
  • Loading branch information
ecdatadog authored Dec 17, 2024
1 parent 465e04d commit 326e1d5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jsonapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 326e1d5

Please sign in to comment.