Graphql 如何在本地模式中使用缝合模式中的类型

Graphql 如何在本地模式中使用缝合模式中的类型,graphql,apollo,apollo-server,Graphql,Apollo,Apollo Server,我有一个GraphQL模式,它使用缝合在本地定义的模式旁边包括一个远程模式 我的缝合逻辑如下所示: const-link=new-HttpLink({ uri:config.cms.endpoint, 取来 }); const remoteSchema=wait introspectSchema(link); const remoteExecutableSchema=makeRemoteExecutableSchema({ 模式:remoteSchema, 链接 }); const localE

我有一个GraphQL模式,它使用缝合在本地定义的模式旁边包括一个远程模式

我的缝合逻辑如下所示:

const-link=new-HttpLink({
uri:config.cms.endpoint,
取来
});
const remoteSchema=wait introspectSchema(link);
const remoteExecutableSchema=makeRemoteExecutableSchema({
模式:remoteSchema,
链接
});
const localExecutableSchema=makeExecutableSchema({
typeDefs,
解析器,
});
const mergedSchema=mergeschema({
模式:[
localExecutableSchema,
remoteExecutableSchema,
],
});
const阿波罗服务器=新阿波罗服务器({
模式:mergedSchema,
...
导入的
typeDefs
变量包含以下定义:

输入订单项{
alphaId:ProductAlphaId!
插件:[ProductAlphaId]!
}
remoteSchema
包含
ProductAlphaId
的定义。但是,由于它是在“远程”架构中定义的,而不是在本地架构中定义的,因此在启动服务器时出现错误:

Could not start server: Unknown type "ProductAlphaId".

我应该如何在一个模式中使用另一个模式中的类型?我知道这可能会创建循环依赖关系,但在我的情况下,我只想在“第二个”模式中使用“第一个”模式中的类型。这可能是个问题,合并时需要检查模式的顺序

。。。
const mergedSchema=mergeschema({
模式:[
remoteExecutableSchema,
localExecutableSchema
],
});
...

这可能就是问题所在,您需要在合并时检查架构的顺序

。。。
const mergedSchema=mergeschema({
模式:[
remoteExecutableSchema,
localExecutableSchema
],
});
...