nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.33k stars 434 forks source link

@canFind is missing "model" argument in graphql definition #2513

Closed rocket-micha closed 4 months ago

rocket-micha commented 4 months ago

Describe the bug

@canFind (introduced in #2483) uses a model argument, which is not part of the graphql definition. This leads to a validation error (in phpstorm for example) when using @canFind()

image

Expected behavior/Solution

Argument "model" should part of the graphql definition / validation should pass

Steps to reproduce

  1. use @canFind directive
  2. see validation error in graphql schema files after generating lighthouse's ide-helper class

Lighthouse Version

6.29.1

P.S.: would be great to get a new bugfix release after this got merged as i'm waiting for this and #2507 :)

k0ka commented 4 months ago

@canFind uses model of the result object (which directive is applied to).

See https://lighthouse-php.com/6/security/authorization.html#protect-mutations-using-database-queries