From discord:
Hey, y'all π
I've been working with strawberry for the last couple of days in order to build a new API that should become our main service for database interactions. Because of that, I have a lot of similar types that also behave quite similar. I thought generics could help to shrink down redundancy, but I cannot get it working, so I hope you guys can help.
The main idea was to use pythons generics to build a generic resolver that can handle default filters that every type has as input. This resolver then would also handle the database interaction through sqlalchemy.orm...
The following example is the shortest example I was able to come up with in order to describe my problem. (If needed i also can provide a longer example that describes this problem)
This example on the playground Works because I commented out the actual code I tried to use, I hope it's clear where the problem is.https://play.strawberry.rocks/?gist=1b8080857854f064a2293778dc6f6805
This use of generics would enable me to write a CRUD class that handles most common calls from strawberry without having to write 4 individual resolver that just wrap the generic one in order to work around using generics directly. Having nearly 40 Strawberry.Types that should be served, this would be quite handy. If a generic resolver is a "wrong" approach i would appreciate every suggestion that helps me reduce redundancy here.
Thanks in advance!
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too