99designs / 99designs/gqlgen

"Must be called from within _entities" on cyclic federated request

Đang mở
#3,711 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
10.8k
Fork
1.3k
Merge trung bình
2 ngày 36 phút
Pull request đã merge (30 ngày)
26

Mô tả

## The Config
`gqlgen.yml`:
```
federation:
filename: graph/federation.go
package: graph
version: 2
options:
computed_requires: true
call_argument_directives_with_null: true
```

## The Schemas
`serviceA.graphqls`:
```
type Query {
entityA(entityAId: String!): EntityA
}

type EntityA @key(fields: "entityAId") {
entityAId: String!
entityB: EntityB @provides(fields: "entityBId")
}

type EntityB @key(fields: "entityBId") @extends {
entityBId: String! @external
entityA: EntityA @requires(fields: "entityBId")
}
```
`serviceB.graphqls`:
```
type Query {
entityB(entityBId: String!): EntityB
}

type EntityB @key(fields: "entityBId") {
entityBId: String!
}
```

## The Test
Request through Apollo Router:
```
query Query {
entityA(entityAId: "EntityAId") {
entityAId
entityB {
entityBId
entityA {
entityAId
}
}
}
}
```

Response:
```
{
"data": {
"entityA": {
"entityAId": "EntityAId",
"entityB": {
"entityBId": "EntityBId",
"entityA": null
}
}
},
"errors": [
{
"message": "must be called from within _entities",
"path": [
"entityA",
"entityB",
"entityA"
],
"extensions": {
"service": "serviceA"
}
}
]
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.