Skip to main content

Module degraphql

Module degraphql 

Source
Expand description

The degraphql node — exposes a GraphQL upstream through a plain REST route: the incoming request is rewritten into a standard GraphQL POST ({"query": ..., "variables": ..., "operationName": ...}) with variables harvested from the client’s query parameters and JSON body.

Port of APISIX’s degraphql plugin. Deviations:

  • The query string is checked only structurally (non-empty, balanced braces) at config load — APISIX parses it with a real GraphQL parser and can enforce operation_name when the document holds several operations.
  • APISIX keeps GET requests as GETs, packing query/variables into the URI arguments; featherbit always rewrites to a JSON POST body, the canonical GraphQL transport, and converts the method accordingly.
  • Variables resolve from query parameters first, then from JSON body fields (APISIX reads only one source depending on the method).

Place this node before the upstream node: it rewrites context.request (method, body, headers) that the upstream forwards.

Structs§

DegraphqlPlugin
Rewrites the request into a GraphQL POST for the configured query.

Functions§

check_query 🔒
Structural sanity check for a GraphQL document: non-blank, contains a selection set, and curly braces are balanced. Not a full parser — see the module docs.