dotkernel / api

DotKernel's PSR-7 REST style API built around the Mezzio API skeleton.
https://docs.dotkernel.org/api-documentation/
MIT License
35 stars 5 forks source link

Page in Collections "out of bounds" #60

Closed arhimede closed 3 years ago

arhimede commented 3 years ago

Page %d is out of bounds. Collection has %d page%s.' https://github.com/mezzio/mezzio-hal/blob/2.1.x/src/ResourceGenerator/ExtractCollectionTrait.php

Line 219

when you try to return pagination results and you are out of bound

Need to be treated in the app code, in the return , a try catch

alexmerlin commented 3 years ago

Both DotKernel API 1.0 and 3.0 return correctly a 400 response when the specified page number is out of bounds. Outputted response should look similar to this:

{
    "error": {
        "messages": [
            "Page 10 is out of bounds. Collection has 9 pages."
        ]
    }
}

With older versions of DotKernel API the issue may still be encountered. In this case we recommend updating your packages using composer update. If the issue still persists, please open a new issue and include the output of composer show command.