graphile / crystal

🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!
https://graphile.org/
Other
12.49k stars 568 forks source link

`makeWrapPlansAfterArgumentsHaveBeenAppliedPlugin` - solve confusion #2062

Open benjie opened 1 month ago

benjie commented 1 month ago

makeWrapPlansPlugin can be confusing because it wraps the plan before the argument plans have been applied.

Let's say someone wanted to add a plan wrapper plugin to reject requests where the "limit" of a fetch was too high. How could we see the size of first/last when they've not been applied yet (without relying on argument names).

Also, in this case we'd probably want to raise the error from nodes rather than from allRows since {allRows{totalCount}} without pagination limits is a perfectly reasonable query, whereas {allRows{nodes{id}}} would not be.