Skip to content

Commit 0b4e017

Browse files
committed
GraphQl-232: GraphQL tools cannot perform "standard introspection query" in production mode
1 parent 410b012 commit 0b4e017

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/internal/Magento/Framework/GraphQl/Query/IntrospectionConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
class IntrospectionConfiguration
1616
{
17-
const CONFIG_PATH_DISABLE_INTROSPECTION = 'graphql/disable_introspection';
17+
private const CONFIG_PATH_DISABLE_INTROSPECTION = 'graphql/disable_introspection';
1818

1919
/**
2020
* @var DeploymentConfig
@@ -35,7 +35,7 @@ public function __construct(
3535
*
3636
* @return int
3737
*/
38-
public function disableIntrospection(): int
38+
public function isIntrospectionDisabled(): int
3939
{
4040
return (int) $this->deploymentConfig->get(self::CONFIG_PATH_DISABLE_INTROSPECTION);
4141
}

lib/internal/Magento/Framework/GraphQl/Query/QueryComplexityLimiter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use GraphQL\Validator\Rules\DisableIntrospection;
1212
use GraphQL\Validator\Rules\QueryDepth;
1313
use GraphQL\Validator\Rules\QueryComplexity;
14-
use Magento\Framework\App\ObjectManager;
1514

1615
/**
1716
* QueryComplexityLimiter
@@ -47,12 +46,11 @@ class QueryComplexityLimiter
4746
public function __construct(
4847
int $queryDepth,
4948
int $queryComplexity,
50-
IntrospectionConfiguration $introspectionConfig = null
49+
IntrospectionConfiguration $introspectionConfig
5150
) {
5251
$this->queryDepth = $queryDepth;
5352
$this->queryComplexity = $queryComplexity;
54-
$this->introspectionConfig = $introspectionConfig ?? ObjectManager::getInstance()
55-
->get(IntrospectionConfiguration::class);
53+
$this->introspectionConfig = $introspectionConfig;
5654
}
5755

5856
/**
@@ -63,7 +61,7 @@ public function __construct(
6361
public function execute(): void
6462
{
6563
DocumentValidator::addRule(new QueryComplexity($this->queryComplexity));
66-
DocumentValidator::addRule(new DisableIntrospection($this->introspectionConfig->disableIntrospection()));
64+
DocumentValidator::addRule(new DisableIntrospection($this->introspectionConfig->isIntrospectionDisabled()));
6765
DocumentValidator::addRule(new QueryDepth($this->queryDepth));
6866
}
6967
}

0 commit comments

Comments
 (0)