strawberry-graphql / strawberry-django

Strawberry GraphQL Django extension
https://strawberry.rocks/docs/django
MIT License
415 stars 120 forks source link

Filter should have default settings for different types to make the graphiql cleaner. #142

Closed ccsv closed 7 months ago

ccsv commented 2 years ago

Different data types should have pre-set filters parameters by default instead of having all the different types of filter applied for each type.

Currently if you apply filters in the graphiql it has all the filters by default as seen here: https://i.stack.imgur.com/D3zeO.jpg

I would propose to have something like these rules for default:

id: exact, inlist string: contains, endswith, icontains, iexact/exact, iregex, isnull, startswith, inlist int/float: exact/iexact, gt, gte, lt, lte, range, isnull, inlist

Some logic like anything with required! should not have isnull

Also an option on the filter when writing the class to modify the filters if you want something not preset as default.

This will make the Graphiql interface more clean and less confusing .

Upvote & Fund

Fund with Polar

bellini666 commented 7 months ago

https://github.com/strawberry-graphql/strawberry-django/pull/478