Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sorting by multiple fields #17

Open
danielrearden opened this issue Jun 23, 2020 · 2 comments
Open

Sorting by multiple fields #17

danielrearden opened this issue Jun 23, 2020 · 2 comments
Labels
phase1 Accepted for refinement

Comments

@danielrearden
Copy link
Contributor

The spec explicitly mentions sorting by multiple fields is not supported. This seems like a fairly basic requirement -- when filtering by non-unique fields, adding a second field to sort by ensures consistent ordering. What's the thinking behind applying this limitation?

For what it's worth, GraphQL coerces non-array inputs into arrays for arguments that are lists. So making orderBy a list doesn't necessarily have to be a breaking change for existing schemas.

Given a schema like

type Query {
  findNotes(orderBy: [OrderByInput!]): NoteResultList!
}

This is still valid:

{
  findNotes(orderBy: { field: id }): {
    items {
      id
    }
  }
}

The value passed to the resolver will be [{ field: "id", order: "ASC" }].

@wtrocki
Copy link
Member

wtrocki commented Jun 24, 2020

Amazing point and yes makes sense! I do not remember what was the reason why we did not do it, but makes sense to not put that as linmitation

@wtrocki
Copy link
Member

wtrocki commented Jun 24, 2020

CC @craicoverflow

@wtrocki wtrocki added the phase1 Accepted for refinement label Jun 24, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
phase1 Accepted for refinement
Projects
None yet
Development

No branches or pull requests

2 participants