Resource limitations: Enforcing pagination limits at router level #1246
-
What is a good way to enforce pagination limits at the router level, without delegating to subgraphs? Here's an example: In other words, I am looking to implement a basic version of https://docs.github.com/en/graphql/overview/resource-limitations at the router level |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think the best way to address this would be to write a plugin. You've got two options: depending on how sophisticated you want your processing to be. If it's very simple, then you might be able to achieve your goal with a rhai plugin, which facilitates basic text manipulation, math, etc.. However, I think you are looking for something more sophisticated, since the link you provide seems to require knowledge of GraphQL Query structure. This would probably require you to write a rust plugin. You may be able to get the information you need to make decisions from the I don't think this is a trivial piece of work. |
Beta Was this translation helpful? Give feedback.
I think the best way to address this would be to write a plugin. You've got two options: depending on how sophisticated you want your processing to be. If it's very simple, then you might be able to achieve your goal with a rhai plugin, which facilitates basic text manipulation, math, etc.. However, I think you are looking for something more sophisticated, since the link you provide seems to require knowledge of GraphQL Query structure. This would probably require you to write a rust plugin.
You may be able to get the information you need to make decisions from the
QueryPlan
that we provide inquery_planning_service
. If not, you will need to parse the request (perhaps using apollo-parser)…