I have a problem with GraphQL and I want to create a federation with Laravel 9. I use: https://lighthouse-php.com/5/federation/getting-started.html to create monolog GraphQL and created 2 Laravel projects named "a" and "b". they work separately good. "a" project has a person table with schema(id, name), and the second project has a post table with schema(id, text,person_id) I want to get person_id from "a" project with GraphQL federation. As I search for federation in other languages I found this link: https://www.apollographql.com/docs/federation/federation-spec/#type-_service and I defined it to my schema but it shows me that there aren't any @key-@extends-@external,... directive for that. I create a directive with the Laravel command: "PHP artisan lighthouse: directive --argument Key" and I created also it for "extend" and "external" but I don't know how can I write down my code in @key resolver and @extends and @external directives. Can anyone help me?
CodePudding user response:
The necessary directives are available in Lighthouse after enabling federation, no need for you to define them. To aid autocompletion and satisfy IDE plugins, use php artisan lighthouse:ide-helper
- see https://lighthouse-php.com/5/api-reference/commands.html#ide-helper