A library that rewrites GraphQL queries in middleware to turn breaking schema changes into non-breaking ones, avoiding the need for versioned fields like `doTheThingV3`. Current stable version is 0.0.19, with no active release cadence (last updated in 2021). Key differentiator: allows schema changes (e.g., `String!` to `ID!`) without breaking old clients, by rewriting queries at the middleware level. Supports express-graphql and Apollo Server. Ships with TypeScript types and has peer dependency on GraphQL 14 or 15.
npm install graphql-query-rewriter-rcNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up middleware to automatically rewrite GraphQL queries, replacing a field argument type from String! to ID! seamlessly.
Pin to exact version and test upgrades thoroughly.
Use graphql@15 or older, or look for alternative packages.
npm install graphql-query-rewriter express-graphql-query-rewriter
Use ES module imports (e.g., import ... from 'graphql-query-rewriter').
Place graphqlRewriterMiddleware before graphqlHTTP in middleware stack.
Run npm install graphql-query-rewriter express-graphql-query-rewriter
Ensure oldType and newType match exactly the schema's type strings (e.g., 'String!' not 'string').
Use ES import: import { graphqlRewriterMiddleware } from 'express-graphql-query-rewriter'