joukevandermaas / saule

JSON API library for ASP.Net Web API 2.
https://joukevandermaas.github.io/saule
MIT License
76 stars 37 forks source link

"Last" key missing for pagination links #127

Closed bxh closed 7 years ago

bxh commented 8 years ago

While JSON spec states that all first, last, prev and next keys must exist for pagination links, the current version of Saule does not support it.

joukevandermaas commented 8 years ago

The relevant part of the spec says:

The following keys MUST be used for pagination links:

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

Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable.

This should be interpreted as: "if you do pagination, do not generate links other than the above". Saule omits links it cannot generate (particularly last, sometimes next and prev) without potential performance problems, which is in accordance with the spec.

I'm not opposed to generating those links anyway under certain conditions (maybe based on a flag in the attribute). This would be a performance trade-off that an app developer can decide, but Saule cannot.