GraphQL Query Rewriter (v3.1.0) is a library that seamlessly rewrites GraphQL queries in middleware to handle breaking schema changes without requiring client updates. It works with express-graphql and apollo-server, providing rewrite rules for field argument type changes, field renames, argument renames, input field changes, and literal value replacements. Released under MIT license with TypeScript type definitions included. The package is maintained by EF Engineering and has an active development cadence with full API documentation available.
npm install graphql-query-rewriterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up GraphQL Query Rewriter middleware with express-graphql to transparently rewrite old String! arguments to ID!.
Ensure app.use('/graphql', graphqlRewriterMiddleware(...)) is called before app.use('/graphql', graphqlHTTP(...)).Migrate from v2-style function rewriters to class instances extending Renamer.
Replace Rector with Renamer from the main package.
Upgrade to a version that supports graphql v15/16, or pin graphql to ^14.0.0.
Write custom rewriters using Renamer for advanced scenarios.
npm install graphql-query-rewriter
import { graphqlRewriterMiddleware } from 'express-graphql-query-rewriter';Use new FieldArgTypeRewriter({ fieldName: '...', argName: '...', oldType: '...', newType: '...' })