From 9a80b8c0a98dc4bc8681cf4fc9b9753730e19ddc Mon Sep 17 00:00:00 2001 From: Alexandr Viniychuk Date: Tue, 6 Jun 2017 22:14:45 -0400 Subject: [PATCH] closes #147 --- Tests/Schema/VariablesTest.php | 18 +++++++++++++++++- .../ResolveValidator/ResolveValidator.php | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Tests/Schema/VariablesTest.php b/Tests/Schema/VariablesTest.php index 334fe4e6..53e2b016 100644 --- a/Tests/Schema/VariablesTest.php +++ b/Tests/Schema/VariablesTest.php @@ -37,11 +37,27 @@ public function testInvalidNullableList() $processor->processPayload( 'query getList($ids: [ID!]) { list(ids: $ids) }', [ - 'ids' => [1, 12, null] + 'ids' => [1, 12] ] ); $this->assertEquals(['data' => ['list' => 'item']], $processor->getResponseData()); + $processor->getExecutionContext()->clearErrors(); + $processor->processPayload( + 'query getList($ids: [ID!]) { list(ids: $ids) }', + [ + 'ids' => [1, 12, null] + ] + ); + $this->assertEquals(['data' => ['list' => null], 'errors' => [ + [ + 'message' => 'Not valid type for argument "ids" in query "list"', + 'locations' => [ + ['line' => 1, 'column' => 35] + ] + ], + ]], $processor->getResponseData()); + $processor->getExecutionContext()->clearErrors(); $processor->processPayload( 'query getList($ids: [ID]) { list(ids: $ids) }', diff --git a/src/Validator/ResolveValidator/ResolveValidator.php b/src/Validator/ResolveValidator/ResolveValidator.php index 2759fb6f..a3b30b15 100644 --- a/src/Validator/ResolveValidator/ResolveValidator.php +++ b/src/Validator/ResolveValidator/ResolveValidator.php @@ -50,7 +50,7 @@ public function assertValidArguments(FieldInterface $field, AstFieldInterface $q case TypeMap::KIND_SCALAR: case TypeMap::KIND_INPUT_OBJECT: case TypeMap::KIND_LIST: - if (!$argument->getType()->isValidValue($argumentType->parseValue($astArgument->getValue()))) { + if (!$argument->getType()->isValidValue($astArgument->getValue())) { $error = $argument->getType()->getLastError(); throw new ResolveException($error ? $error : sprintf('Not valid type for argument "%s" in query "%s"', $astArgument->getName(), $field->getName()), $astArgument->getLocation()); }