This repository has been archived by the owner on Feb 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 234
Update to latest version of graphql-php #330
Comments
The issue with the current scalar types is that they cover up errors. For example, the rule to <?php
namespace App\GraphQL\Types;
use GraphQL\Type\Definition\Type;
use Folklore\GraphQL\Support\Type as BaseType;
class TestType extends BaseType
{
protected $attributes = [
'name' => 'Test',
'description' => 'A type',
];
public function fields()
{
return [
'result' => [
'type' => Type::boolean(),
],
];
}
} <?php
namespace App\GraphQL\Mutations;
use Folklore\GraphQL\Support\Mutation;
use GraphQL;
use GraphQL\Type\Definition\Type;
class TestMutation extends Mutation
{
public function type()
{
return GraphQL::type('Test');
}
public function args()
{
return [
'input' => [
'type' => Type::boolean(),
'rules' => 'boolean'
],
];
}
public function resolve($root, $args)
{
return ['result' => $args['input']];
}
} The behaviour differs depending on how If it is written inline as part of the query, it is validated through the Schema Definition and never even gets to the Laravel Validation. If it is passed as a variable, the value is coerced in Consider the following query: mutation test($input: Boolean) {
test(input: $input) {
result
}
} The following shows the current behaviour: Truthy:
Falsy:
This passes through to Laravel and gets caught there:
For completeness sake, if variables are left blank:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, i have been using your package for a bit now - it is great, thank you!
I have been having issues with the type coercion of the built-in scalar types of
graphql-php
. After some investigation, i found that the issue has been fixed in the upstream library.From version
0.11
going forward, they have added more strict input type coercion for scalars - a feature which i desperately require. Do you have plans to update to a newer version? If so, can i assist with that?The text was updated successfully, but these errors were encountered: