gqlgen
gqlgen copied to clipboard
Federation example not working out-of-the-box
What happened?
I cloned the gqlgen repo and tried the federation example. I get an error with the federation example after starting up the services and also the federation gateway:
What did you expect?
I expected the example to work, I didn't change any code and was just following the tutorial here: https://gqlgen.com/recipes/federation/
Minimal graphql.schema and models to reproduce
The ./accounts/schema.graphqls
file seems to be missing the reviews field? I'm not sure yet if this is the issue:
extend type Query {
me: User
}
type EmailHost @key(fields: "id") {
id: String!
name: String!
}
type User @key(fields: "id") {
id: ID!
host: EmailHost!
email: String!
username: String!
}
versions
-
go run github.com/99designs/gqlgen version
? 0.16.0 -
go version
? go1.18 linux/amd64
Hi- I can't seem to replicate with the example within the _examples/federation/
folder;
Running:
query me {
me{
username
reviews {
body
product {
name
upc
}
}
}
}
nets me:
{
"data": {
"me": {
"username": "Me",
"reviews": [
{
"body": "A highly effective form of birth control.",
"product": {
"name": "Trilby",
"upc": "top-1"
}
},
{
"body": "Fedoras are one of the most fashionable hats around and can look great with a variety of outfits.",
"product": {
"name": "Fedora",
"upc": "top-2"
}
}
]
}
}
}
Which is expected. Are you starting the gateway + subgraphs using the included shell script?