mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 04:46:04 +03:00
Adds example for enabling the DisableIntrospection rule.
This commit is contained in:
parent
719a438628
commit
beaf91d080
18
README.md
18
README.md
@ -559,6 +559,24 @@ $queryDepth->setMaxQueryDepth($maxQueryDepth = 10);
|
|||||||
GraphQL::execute(/*...*/);
|
GraphQL::execute(/*...*/);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Disabling Introspection
|
||||||
|
|
||||||
|
This is a PHP port of [graphql-disable-introspection](https://github.com/helfer/graphql-disable-introspection).
|
||||||
|
The rule prohibits queries that contain `__type` or `__schema` fields.
|
||||||
|
|
||||||
|
This document validator rule is disabled by default. Here an example to enable it:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use GraphQL\GraphQL;
|
||||||
|
use GraphQL\Validator\Rules\DisableIntrospection;
|
||||||
|
|
||||||
|
/** @var \GraphQL\Validator\Rules\DisableIntrospection $disableIntrospection */
|
||||||
|
$disableIntrospection = DocumentValidator::getRule('DisableIntrospection');
|
||||||
|
$disableIntrospection->setEnabled(DisableIntrospection::ENABLED);
|
||||||
|
|
||||||
|
GraphQL::execute(/*...*/);
|
||||||
|
```
|
||||||
|
|
||||||
### More Examples
|
### More Examples
|
||||||
Make sure to check [tests](https://github.com/webonyx/graphql-php/tree/master/tests) for more usage examples.
|
Make sure to check [tests](https://github.com/webonyx/graphql-php/tree/master/tests) for more usage examples.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user