Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "prev" field in Link attribute #60

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Conversation

ecdatadog
Copy link
Contributor

In JSON API specification, there are 4 fields that are mandatory :

  • first: the first page of data
  • last: the last page of data
  • prev: the previous page of data
  • next: the next page of data

There is currently a previous field but no prev field. This PR add prev field and keeps previous field for backwards compatibility

@chrismclennon chrismclennon requested review from a team, turettn and hgu7 and removed request for a team December 17, 2024 01:57
@@ -84,6 +85,7 @@ type Link struct {
Last string `json:"last,omitempty"`
Next string `json:"next,omitempty"`
Previous string `json:"previous,omitempty"`
Copy link
Collaborator

@chrismclennon chrismclennon Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I'd recommend placing the comment as close to the field as possible, I believe it will be more readable this way.

Suggested change
Previous string `json:"previous,omitempty"`
// Previous is deprecated and kept for backwards compatibility. Instead, use the Prev field.
Previous string `json:"previous,omitempty"`

or perhaps,

Suggested change
Previous string `json:"previous,omitempty"`
// DEPRECATED: Use the Prev field.
Previous string `json:"previous,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the comment !

Copy link

@zestze zestze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zestze zestze merged commit 326e1d5 into DataDog:main Dec 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants