strapi
strapi copied to clipboard
GraphQL Plugin: sorting isn't typed accurately
The getting started template on this repo works great as a reproducible example: https://github.com/strapi/strapi/tree/main/examples/getstarted
Bug report
Required System information
- Node.js version: 16.17.0
- NPM version: 8.15.0
- Strapi version: 4.3.6
- Database: PostgreSQL
- Operating system: MacOS
Describe the bug
When sorting there's no type-safety, you just type a string and hope that it's a field. a possible improvement for this would be to generate all of the fields combined with DESC and ASC as enum variants in the graphql schema
Steps to reproduce the behavior
- Go to
http://localhost:1337/graphql - Query a content type and try to sort it
- It's of type
[String]so no auto-completion/validation is provided
Expected behavior
I think this is a much better experience
{
movies(sort: [rating_ASC, date_DESC]) {...}
}
Screenshots