I have one of my endpoint returns a paginated list of documents.
Each page of results contains URL for next/prev/first/last page of output besides the array of documents to display.
If one of these actions make no sense, the corresponding field is missing.
For example the first query returns N entries plus the 'next' field for the next N documents and 'last' that display the last page of documents.
In the client it is easy to enable/disable navigation buttons based on the presence/absence of the corresponding URL in the server response.
But Swagger editor complains that 'A deterministic version of a JSON Schema object.' if I define the response this way:
prev:
type: integer
required: false
I think the alternative solutions, like returning an empty field if the action is not valid, are not so clear and changing the design just to satisfy the editor is questionable in my opinion.
Please enlighten me.
Thanks!
mario