You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use Federation in my supergraph.
I have 2 microservices, each one with the own schema: 1. first subgraph has:
type User @key(fields: id) @guard {
id: ID!
firstname: String!
}
2. second subgraph has:
type GraphUnion {
id: ID!
user_id: Int
text: String
user: User! @hasOne
}
type User @extends @key(fields: "id") {
id: ID! @external
}
I make a Type(app/graphql/types) in the second microservice where I extend the User:
final class User
{
public function __invoke($representation): array
{
return [
'__typename' => 'User',
'id' => 23
];
}
}
When I use rover subgraph check ...
I received the following
SATISFIABILITY_ERROR: The following supergraph API query:
{
graphUnion {
user {
firstname
}
}
}
cannot be satisfied by the subgraphs because:
- from subgraph "...":
- cannot find field "User.firstname".
- cannot move to subgraph "users", which has field "User.firstname", because type "User" has no @key defined in subgraph "users".
Could someone help me?
The text was updated successfully, but these errors were encountered:
After I used, php artisan -W --federation lighthouse:print-schema worked.
I didn't find in the documentation that part with --federation or I somehow missed that.
In that way the schema generate by library contains also @key, @extend and @external directives.
**print-schema**
php artisan lighthouse:print-schema
This can be quite useful, as the root .graphql files do not necessarily contains the whole schema. Schema imports, native PHP types and schema manipulation may influence the final schema.
Use the -W / --write option to output the schema to the default file storage (usually storage/app) as lighthouse-schema.graphql.
You can output your schema in JSON format by using the --json flag
This is in documentation, I think you can add also --federation
I tried to use Federation in my supergraph.
I have 2 microservices, each one with the own schema:
1. first subgraph has:
2. second subgraph has:
I make a Type(app/graphql/types) in the second microservice where I extend the User:
When I use rover subgraph check ...
I received the following
Could someone help me?
The text was updated successfully, but these errors were encountered: