Graphql 我可以有一个联邦图,其中接口的实现在两个独立的服务中吗
您好,快速graphQL联盟问题。我在服务a中实现了类型a。我在服务B中添加了类型为SomeInterface的字段interfaceFields。在服务B中,我实现了SomeInterface。所以我的问题是,如果我运行这个查询,我是否可以使用SomeInterface的另一个实现创建另一个服务Graphql 我可以有一个联邦图,其中接口的实现在两个独立的服务中吗,graphql,apollo-federation,Graphql,Apollo Federation,您好,快速graphQL联盟问题。我在服务a中实现了类型a。我在服务B中添加了类型为SomeInterface的字段interfaceFields。在服务B中,我实现了SomeInterface。所以我的问题是,如果我运行这个查询,我是否可以使用SomeInterface的另一个实现创建另一个服务 { A(search: "test") { field interfacFields { __typename ... on SomeI
{
A(search: "test") {
field
interfacFields {
__typename
... on SomeInterfaceImpl1 {
id
}
... on SomeInterfaceImpl2 {
id
}
}
}
}
它将从服务b获得一些InterfaceImpl1,从服务c获得一些InterfaceImpl2。现在我有这个
服务A
type Query {
A(Search: String!): A
}
type A @key(fields: "id") {
id: String
}
服务B
type A @key(fields: "id") @extends {
id: String @external
interfaceFields: [SomeInterface]
}
interface SomeInterface {
id: String!
}
type SomeInterfaceImpl1 implements SomeInterface {
id: String
title: String
}
服务C
type Page @key(fields: "id") @extends {
slug: String @external
}
interface SomeInterface @extends{
id: String! @external
}
type SomeInterfaceImpl2 implements SomeInterface {
id: String
title: String
}
我得到这个错误
GraphQLError:类型UnknownType的验证错误:未知类型SomeInterfaceImpl2@'\u实体/接口字段
我只是不知道该为服务C做些什么,甚至不知道这是否可行。无论如何,任何帮助都将不胜感激