Closed stephenjason89 closed 4 years ago
never seen this, the field directive is here https://lighthouse-php.com/4.12/api-reference/directives.html#field and is used to tell the mutation what resolver to use.
I'm sorry i haven't been clear: This is the error that I'm getting
This is my auth.graphql register input and mutation
` input RegisterInput { name: String! @rules(apply: ["required", "string"]) nickname: String @rules(apply: ["string"]) cellphone: Json! @rules(apply: ["required", "json"]) landline: Json @rules(apply: ["json"]) username: String! @rules(apply: ["required", "string"]) age: Int @rules(apply: ["int"]) gender: String @rules(apply: ["string"]) birthday: Date @rules(apply: ["date"]) email: String! @rules(apply: ["required", "email", "unique:users,email"]) password: String! @rules(apply: ["required", "confirmed", "min:8"]) password_confirmation: String! }
` type Mutation { register(input: RegisterInput @spread): RegisterResponse! @field(resolver: "Joselfonseca\LighthouseGraphQLPassport\GraphQL\Mutations\Register@resolve") }
The error can easily be solved by adding a
$table->string('directive')->nullable();
in users migration file
Thank you
I don't know why it requires this field and also i saw your migration file has
` Schema::table('users', function (Blueprint $table) { $table->string('provider')->nullable(); $table->string('provider_id')->nullable();
if (!Schema::hasColumn('users', 'avatar')) {
$table->string('avatar')->nullable();
}
});
` But i don't see it being used.
Thank you
I don't see the directive field being used at all.
Correct, that is why I haven't encounter this, maybe is coming from another part in your schema
Thank you, I have opened another issue with the proposed solution https://github.com/joselfonseca/lighthouse-graphql-passport-auth/issues/103
your BaseAuthResolver already has the exception to that field
public function buildCredentials(array $args = [], $grantType = 'password')
{
$args = collect($args);
$credentials = $args->except('directive')->toArray();
$credentials['client_id'] = $args->get('client_id', config('lighthouse-graphql-passport.client_id'));
$credentials['client_secret'] = $args->get('client_secret', config('lighthouse-graphql-passport.client_secret'));
$credentials['grant_type'] = $grantType;
return $credentials;
}
I don't know if it is a feature but it ask for the users table to have a directive field.
What is the directive field for? It is null on all the users though