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" }].
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
orderBya list doesn't necessarily have to be a breaking change for existing schemas.Given a schema like
This is still valid:
The value passed to the resolver will be
[{ field: "id", order: "ASC" }].