A CLI tool for merging GraphQL schema files and validating operations against the merged schema, developed by AWS Labs. Version 1.1.8 is the latest stable release. It supports custom validation rules, glob patterns for schema and operation files, and TypeScript types. Unlike graphql-tools which is more comprehensive, this tool focuses specifically on schema merging and operation validation with a simple CLI interface. The package includes directives merging as an option and provides exit codes for CI integration.
npm install graphql-schema-utilitiesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Merge all .graphql files in current directory, validate operations against merged schema, apply custom rules, output merged schema to file.
Enclose glob patterns in single quotes: -s '{src/**/*.graphql,lib/**/*.graphql}'Add `-d` flag when merging schemas with custom directives: graphql-schema-utilities -s 'schema.graphql' -d
Compile TypeScript rules to .js files and reference the compiled output.
Use the CLI exclusively via npx or global install; programmatic usage is no longer supported.
Define rules with proper TypeScript types using 'ValidationContext' from 'graphql/type/validation'.
Workaround: rename the output file manually; fixed in v2.0.0 (not yet released).
Use npx: npx graphql-schema-utilities -s 'schema.graphql'
Wrap the glob in quotes: -s '{First_Directory/**/*.graphql,Second_Directory/**/*.graphql}'Use `-d` or `--includeDirectives` (camelCase) as per documentation: graphql-schema-utilities -s 'schema.graphql' -d
Use `context.reportError(new GraphQLError(...))` (method call) instead of `context.reportError = ...`.