-
-
Notifications
You must be signed in to change notification settings - Fork 271
Closed
Description
Hello,
Is it possible that #126 broke the default Upload type in existing implementations?
File uploads were working fine until the update. When I try to upload now, I get the Unkown type 'Upload" error back from the server.
I see that you can provide a name to the UploadType constructor, but it defaults to 'Upload'. Is it possible the '_upload' suffix is creating problems? I have tried different names in my query, but that doesn't change anything.
For completeness my Mutation and GraphQL query:
namespace App\GraphQL\Mutation;
use App\Classes\User\Tier;
use App\Verification;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use Illuminate\Validation\Rule;
use Rebing\GraphQL\Support\Mutation;
use Rebing\GraphQL\Support\SelectFields;
use Rebing\GraphQL\Support\UploadType;
use GraphQL;
class AddImageToVerification extends Mutation
{
protected $attributes = [
'name' => 'addImageToVerification',
];
/**
* The allowed field names for
* images that are added to the verification.
*
* @var array
*/
protected $allowedFields = [
'passport', 'selfie', 'address'
];
public function type()
{
return GraphQL::type('Verification');
}
public function args()
{
return [
'id' => [
'name' => 'id',
'type' => Type::int(),
'rules' => [
'required', 'exists:verifications'
]
],
'field' => [
'name' => 'field',
'type' => Type::string(),
'rules' => [
'required',
'string',
Rule::in($this->allowedFields)
]
],
'file' => [
'name' => 'file',
'type' => new UploadType(),
'rules' => [
'required', 'image', 'max:8096'
]
]
];
}
public function resolve($root, $args, SelectFields $fields, ResolveInfo $info)
{
// Omitted
}
} mutation addImage($id: Int!, $field: String!, $file: Upload!) {
add_image_to_verification(id: $id, field: $field, file: $file) {
id
}
}Thanks in advance.
albertcito
Metadata
Metadata
Assignees
Labels
No labels