99designs / 99designs/gqlgen

Updated Federation demo fails

Open
#1,270 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

### What happened?

I enriched the basic federation demo bundled with gqlgen to the latest version. The latest version introduces an additional inventory service to demo *provides*, *external* and *requires* directives.

Upon starting the servers, I get those errors:

```
This data graph is missing a valid configuration. [inventory] Product.weight -> marked @external but weight is not defined on the base service of Product (products)

[inventory] Product.price -> Type `Int` does not match the type of the original field in products (`Int!`)
```

### What did you expect?

Well, it should not bark about configuration issues and schema misalignment: I double-checked all the schemas,

[product]
```
extend type Query {
topProducts(first: Int = 5): [Product]
}

type Product @key(fields: "upc") {
upc: String!
name: String
price: Int
weight: Int
}
```

[inventory]
```
type Product @extends @key(fields: "upc") {
upc: String! @external
weight: Int @external
price: Int @external
inStock: Boolean
shippingEstimate: Int @requires(fields: "price weight")
}
```

As you can see, the price definition matches.
Also looking at the generated code, weight is implemented.

### Minimal graphql.schema and models to reproduce

```
git clone git@github.com:orefalo/federation-demo-golang.git
cd federation-demo-golang
make build
start.sh
```

### versions
- `gqlgen version`? v0.11.3
- `go version`? go version go1.14.5 darwin/amd64
- dep or go modules? modules

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.