You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It is not possible to enforce pagination using auto-generated resolvers. This makes it easy for API requests to ask for more data than can fit into memory, crashing the API.
Describe the solution you'd like
For context, we're using the generated relational resolvers currently, but are hoping to implement graphql amount limiting / pagination across the API. Something similar to this.
In resolvers we've written ourselves, I'd simply replace the type of take in any FindManyXYZArgs with a custom scalar that enforces minimum and maximum values, additionally making it required rather than nullable.
Unfortunately this isn't possible with generated resolvers.
I'd imagine an ideal solution would allow me to do something like:
Would you consider a PR to add this to the generator?
Describe alternatives you've considered
As an alternative, I've considered doing a one-time generation of the relational resolvers to my repository, then discontinuing use of the generated relational resolvers going forward. This creates a fairly large (new) burden on developers for future work however.
The text was updated successfully, but these errors were encountered:
@MichalLytek is there currently a way to add those defaultTake or maxTake configs you mentioned? Or were you saying that that's what this requested feature needs to add?
Is your feature request related to a problem? Please describe.
It is not possible to enforce pagination using auto-generated resolvers. This makes it easy for API requests to ask for more data than can fit into memory, crashing the API.
Describe the solution you'd like
For context, we're using the generated relational resolvers currently, but are hoping to implement graphql amount limiting / pagination across the API. Something similar to this.
In resolvers we've written ourselves, I'd simply replace the type of
take
in anyFindManyXYZArgs
with a custom scalar that enforces minimum and maximum values, additionally making it required rather than nullable.Unfortunately this isn't possible with generated resolvers.
I'd imagine an ideal solution would allow me to do something like:
Would you consider a PR to add this to the generator?
Describe alternatives you've considered
As an alternative, I've considered doing a one-time generation of the relational resolvers to my repository, then discontinuing use of the generated relational resolvers going forward. This creates a fairly large (new) burden on developers for future work however.
The text was updated successfully, but these errors were encountered: