DEV Community

Discussion on: Why I no longer use GraphQL for new projects

 
akapulka profile image
akapulka

Dunno what tools you're using but for example laravel lighthouse has @can directive and all you have to do is place it on your schema or even field. lighthouse-php.com/master/api-refe...

Thread Thread
 
rcls profile image
OssiDev

I actually developed a middleware in PHP for GraphQL, that uses directives. I can define, as an example, a@signed directive that forces users to go through authentication middleware. Basically you can inject yourself to the parsing process and put your stuff in there. Many developers just don't wanna dig deeper into that and prefer using ready-to-use frameworks that do all the heavy lifting. I also implemented a directive for fields which hides them from introspection.

But you're right, it's not easy to do and many libraries don't include something like this. GraphQL is very complex and the support for some languages is lacking.