graphql-relay-py icon indicating copy to clipboard operation
graphql-relay-py copied to clipboard

Adding support for limiting array length and updated next/previous logic

Open wakemaster39 opened this issue 6 years ago • 1 comments

It is possible to trivially add support for limiting the size of a return object. This is important because people might ask for 10,000 items and we need to enforce a hard limit on the number of items.

From my understanding, the relay spec has also been modified to allow better handling of the hasPreviousPage/hasNextPage logic, https://github.com/facebook/relay/pull/2079.

Since we have just a list here, it is very simple to have more accurate hasPreviousPage and hasNextPage logic. Should make it easier to support windowed pagination.

Seeing if this is something that would be considered before I tackle the tests.

wakemaster39 avatar Feb 27 '19 22:02 wakemaster39

The problem with adding new features is that graphql-relay-py is a port of graphql-relay-js and we want to keep it compatible and up to date with the code and API upstream. If we add new features, and then they do it differently, we diverge. Also it becomes harder and harder to keep up to date with future changes in graphql-relay-js and maintain compatibility when we allow the code and API to diverge.

So my request is that before adding new features, we should at least discuss with the graphql-relay-js folks, e.g. by creating an issue there or even offering a PR (in this case creating a PR for JavaScript should be possible even if you're not a JavaScript expert). Also if we have two different solutions, this would be a good opportunity to discuss together with them which one is better. If we don't get feedback, we can still decide to move forward on our own account.

Let me know if you want me to start this discussion (just give me a few days) or if you want to do it.

Cito avatar Jan 30 '20 11:01 Cito