A validation rule for graphql-js that disables introspection queries by rejecting any query containing __schema or __type fields. Current stable version is 1.2.0. The package has been in maintenance mode with infrequent updates. It supports a broad range of graphql versions (0.9.x through 15.x). A key differentiator is its simplicity compared to more complex middleware solutions like graphql-no-introspection, though it only blocks specific field names rather than the introspection query system as a whole.
npm install graphql-disable-introspectionNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to add the rule to an Apollo Server Express or express-graphql setup to block introspection queries.
Consider using a more comprehensive solution like graphql-no-introspection or extending the rule to block __typename if needed.
If you need to block __typename, you must implement a custom rule or use another package.
Implement a custom rule that traverses field definitions regardless of alias, or use a more robust introspection blocker.
Consider migrating to graphql-no-introspection or using built-in options like Apollo Server's 'introspection: false'.
Pass NoIntrospection as an element in the array: validationRules: [NoIntrospection]
Upgrade graphql-js to >=0.10.0 or apply the rule differently.
Run 'npm install graphql-disable-introspection' or add it to package.json.