daniel-de-wit / lighthouse-sanctum

Laravel Sanctum support for Laravel Lighthouse
MIT License
56 stars 9 forks source link

Refactor "unique:users,email" validation #22

Closed wimski closed 3 years ago

wimski commented 3 years ago

The following definition exists with validation for user email uniqueness.

input RegisterInput {
    name: String! @rules(apply: ["required", "string"])
    email: String! @rules(apply: ["required", "email", "unique:users,email"])
    password: String! @rules(apply: ["required", "confirmed"])
    password_confirmation: String! @rules(apply: ["required", "string"])
    verification_url: VerificationUrlInput
}

This validation has two potential issues:

Further investigation is needed how to solve this.

wimski commented 3 years ago

@daniel-de-wit I've come to the conclusion that there is no conclusive way to dynamically determine any deviations from the standard email unique constraint. 99% of cases will have 'users' with an 'email' field that should be unique. For those that deviate, they can change the schema which should be published anyway. So I consider this a non-issue.