Skip to content

change the name of pagination fields. #345

Closed
@kasir-barati

Description

@kasir-barati

Is your feature request related to a problem? Please describe.

It is a really good idea to rethink and potentially change our naming conventions for naming fields. In the GraphQL doc, in the best practices, under the "Complete connection model" it is worth noting that it is naming the fields like this:

pluralNameConnection

For example it uses friendsConnection and not friends.

Note

Unfortunately I did not where I read/heard for the first time that it is a good idea to add the Connection suffix to the name of your field that needs to have pagination enabled 🥲.

Have you read the Contributing Guidelines?

Yes.

Describe the solution you'd like

I guess it's gonna be fairly simple, instead of todos we're gonna have todosConnection. And then we can let devs to use one over another (I mean now we can have the normal todos field to do an offset pagination or alternatively we can add Offset suffix to these fields as well).

This gives us the ultimate flexibility that we need. Think of it this way, you're now developing a GraphQL API, and your in love with the concept of not having to deal with versioning anymore. So with that in mind now you've implemented the cursor based pagination and so far everything is cool but then you need to switch to offset pagination for some unknown reasons. So now if we switch from cursor based pagination to the offset base pagination as describe in the docs with @QueryOptions({ pagingStrategy: PagingStrategies.OFFSET }) you're gonna introduce breaking change.

And this is not a desirable outcome. Let's also forget about the fact that we have @deprecated directive just to enable our clients to have a much smoother transition to the new API.

Describe alternatives you've considered

I am not sure and have not tried it yet I could always go with @Relation('todoItem', () => TodoItemDTO, { connectionName: 'todoItemsConnection' }).

Additional context

But my point here is our default behaviors, and possibly supporting two different kind of pagination strategy at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions