AlinsRan opened a new pull request, #13372:
URL: https://github.com/apache/apisix/pull/13372

   ## Summary
   
   Add a new `graphql-limit-count` plugin that limits the rate of GraphQL 
requests based on the depth of the query AST within a given time window.
   
   Unlike `limit-count` (which counts each request as cost 1), this plugin uses 
the **GraphQL query AST depth** as the cost. This allows you to enforce 
stricter limits on deeply nested queries that are more expensive to process.
   
   ## Changes
   
   - **Plugin**: `apisix/plugins/graphql-limit-count.lua` — new plugin 
(priority 1004) that:
     - Accepts only `POST` requests with `application/json` or 
`application/graphql` content types
     - Parses the GraphQL request body and computes the AST depth
     - Delegates rate limiting to `limit-count/init.lua`, passing the depth as 
the cost
     - Supports local, Redis, and Redis cluster policies (same schema as 
`limit-count`)
   - **Tests**: `t/plugin/graphql-limit-count.t` — 14 test cases covering 
normal operation, error handling (wrong method, missing body, invalid 
content-type, malformed JSON, missing query, parse failure, empty query), and 
Redis/Redis-cluster policies
   - **Config**: `apisix/cli/config.lua` — register plugin and add shared dict 
defaults (`plugin-graphql-limit-count`, 
`plugin-graphql-limit-count-reset-header`)
   - **Template**: `apisix/cli/ngx_tpl.lua` — add conditional shared dict 
declarations for the plugin
   - **Docs**: English and Chinese plugin documentation added, sidebar 
navigation updated


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to