|
24 | 24 | use GraphQL\Utils\AST; |
25 | 25 | use GraphQL\Utils\TypeInfo; |
26 | 26 | use GraphQL\Utils\Utils; |
27 | | -use GraphQL\Validator\Rules\AbstractValidationRule; |
| 27 | +use GraphQL\Validator\Rules\ValidationRule; |
28 | 28 | use GraphQL\Validator\Rules\QueryComplexity; |
29 | | -use GraphQL\Validator\ValidationContext; |
| 29 | +use GraphQL\Validator\QueryValidationContext; |
30 | 30 | use Symfony\Component\HttpFoundation\RequestStack; |
31 | 31 |
|
32 | 32 | /** |
@@ -197,7 +197,7 @@ protected function executeOperation(PromiseAdapter $adapter, ServerConfig $confi |
197 | 197 | // in the same document, hence this check is sufficient. |
198 | 198 | $operation = $params->operation; |
199 | 199 | $type = AST::getOperationAST($document, $operation); |
200 | | - if ($params->isReadOnly() && $type->operation !== 'query') { |
| 200 | + if ($params->readOnly && $type->operation !== 'query') { |
201 | 201 | throw new RequestError('GET requests are only supported for query operations.'); |
202 | 202 | } |
203 | 203 |
|
@@ -352,14 +352,14 @@ protected function validateOperation(ServerConfig $config, OperationParams $para |
352 | 352 |
|
353 | 353 | $schema = $config->getSchema(); |
354 | 354 | $info = new TypeInfo($schema); |
355 | | - $validation = new ValidationContext($schema, $document, $info); |
356 | | - $visitors = array_values(array_map(function (AbstractValidationRule $rule) use ($validation, $params) { |
| 355 | + $validation = new QueryValidationContext($schema, $document, $info); |
| 356 | + $visitors = array_values(array_map(function (ValidationRule $rule) use ($validation, $params) { |
357 | 357 | // Set current variable values for QueryComplexity validation rule case. |
358 | 358 | // @see \GraphQL\GraphQL::promiseToExecute for equivalent |
359 | 359 | if ($rule instanceof QueryComplexity && !empty($params->variables)) { |
360 | 360 | $rule->setRawVariableValues($params->variables); |
361 | 361 | } |
362 | | - return $rule($validation); |
| 362 | + return $rule->getVisitor($validation); |
363 | 363 | }, $rules)); |
364 | 364 |
|
365 | 365 | // Run the query visitor with the prepared validation rules and the cache |
@@ -434,7 +434,7 @@ protected function resolveValidationRules(ServerConfig $config, OperationParams |
434 | 434 | * @throws \GraphQL\Server\RequestError |
435 | 435 | */ |
436 | 436 | protected function loadPersistedQuery(ServerConfig $config, OperationParams $params) { |
437 | | - if (!$loader = $config->getPersistentQueryLoader()) { |
| 437 | + if (!$loader = $config->getPersistedQueryLoader()) { |
438 | 438 | throw new RequestError('Persisted queries are not supported by this server.'); |
439 | 439 | } |
440 | 440 |
|
|
0 commit comments