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

'Pagination' section of the spec is basically a lie #1523

Closed
richvdh opened this issue Aug 16, 2018 · 3 comments
Closed

'Pagination' section of the spec is basically a lie #1523

richvdh opened this issue Aug 16, 2018 · 3 comments
Assignees
Labels
spec-bug Something which is in the spec, but is wrong

Comments

@richvdh
Copy link
Member

richvdh commented Aug 16, 2018

There's a whole section in the spec about 'pagination', with the implication that lots of endpoints in the CS API follow the same pattern. In fact, the only one that I think follows this pattern is /messages, and others (/publicRooms, /notifications, /search) use different systems.

There's also an M_BAD_PAGINATION error code which I would be surprised to discover is actually used.

@richvdh richvdh added the spec-bug Something which is in the spec, but is wrong label Aug 16, 2018
@richvdh
Copy link
Member Author

richvdh commented Aug 16, 2018

I think the action here is to make sure that /messages (and its interaction with the tokens returned by /sync, /context, /search, etc) is adequately documented, and then kill the section.

@ara4n
Copy link
Member

ara4n commented Aug 16, 2018

i think this might be a slight overstatement - i think there's some value in the various APIs which do pagination having the same shape (i.e. a chunks array, and a prev_batch and next_batch results which give opaque tokens which can be fed back to the API to go backwards & forwards, and whose tokens point to the gaps between objects in the chunks sequence). And I think other APIs /do/ follow this a bit?

@turt2live turt2live self-assigned this Aug 31, 2018
@turt2live
Copy link
Member

It looks like M_BAD_PAGINATION is not emitted from synapse at all:

Clients do appear to make use of it where they can, however:

although they also don't make use of the code outside of declaring it. I think if we were to use it, it would be best to declare it as M_INVALID_PARAM which appears to be used elsewhere in the spec, but may not be used for pagination currently.

Thoughts?

turt2live added a commit to turt2live/matrix-doc that referenced this issue Aug 31, 2018
Previously the section was very strict in what pagination was, however this isn't the reality for the matrix specification. Several endpoints have their own pagination naming conventions and do not follow those mandated by this section.

This commit generalizes the language to cover those endpoints while also describing how pagination works. In particular, it describes the rough API shape to expect and how to deal with the responses.

This commit also removes the `M_BAD_PAGINATION` error as it is not used in the real world. Homeservers are instead encouraged to use the standard `M_INVALID_PARAM` or similar error code.

Fixes matrix-org#610
Fixes matrix-org#1523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec-bug Something which is in the spec, but is wrong
Projects
None yet
Development

No branches or pull requests

3 participants