不能从另一个 schema.graphql 文件中的 schema stiching 访问共享的模式。
创始人
2024-12-27 02:30:16
0

要解决不能从另一个schema.graphql文件中的schema stitching访问共享的模式的问题,可以采用以下解决方法:

  1. 创建一个共享的schema.graphql文件,其中包含共享模式的定义。
# 共享的schema.graphql文件
type Query {
  sharedField: String
}
  1. 在主要的schema.graphql文件中导入共享的模式,并将其与其他模式进行合并。
const { mergeTypeDefs } = require('@graphql-tools/merge');
const { loadFilesSync } = require('@graphql-tools/load-files');

const sharedTypeDefs = loadFilesSync('path/to/shared/schema.graphql');
const otherTypeDefs = loadFilesSync('path/to/other/schema.graphql');

const mergedTypeDefs = mergeTypeDefs([sharedTypeDefs, otherTypeDefs]);

module.exports = mergedTypeDefs;
  1. 在主要的schema.graphql文件中使用schema stitching来将合并后的模式与其他模式进行连接。
const { stitchSchemas } = require('@graphql-tools/stitch');

const mergedSchema = stitchSchemas({
  schemas: [mergedTypeDefs, otherSchemas],
});

module.exports = mergedSchema;

通过这种方式,可以在不同的schema.graphql文件中定义和维护共享的模式,并使用schema stitching将它们连接起来以构建完整的模式。这样,就可以从另一个schema.graphql文件中访问共享的模式。

相关内容

热门资讯

检测7分钟!wpk有透视外挂德... 检测7分钟!wpk有透视外挂德扑之星软件透明软件(其实真的有挂)-小红书;1、德扑之星软件透明软件透...
德州版一分钟!wopoker用... 德州版一分钟!wopoker用ai有用wpk可以下载ios(好像真的有挂)-小红书1、玩家可以在wp...
开挂六分钟!aapoker透视... 开挂六分钟!aapoker透视辅助微扑克算正规平台(的确真的有挂)-知乎1、点击下载安装,微扑克算正...
计算器7分钟!wpk ai机器... 计算器7分钟!wpk ai机器人和真的的区别wepokeai代打的胜率(都是真的有挂)-知乎;1、完...
安装4分钟!微扑克辅助工具可以... 安装4分钟!微扑克辅助工具可以下载德州游戏辅助器大全(一直真的有挂)-小红书;1、玩家可以在微扑克辅...
私人局9分钟!wepoke的机... 私人局9分钟!wepoke的机制aapoker俱乐部后天可以操作(的确真的有挂)-哔哩哔哩1、aap...
盈利2分钟!wpk提高胜率德州... 盈利2分钟!wpk提高胜率德州辅助软件线上(一般真的有挂)-微博客户端;1、德州辅助软件线上透视辅助...
ai辅助一分钟!微扑克辅助器i... ai辅助一分钟!微扑克辅助器ioswepoke有科技(的确真的有挂)-微博客户端;暗藏猫腻,小编详细...
俱乐部5分钟!governor... 俱乐部5分钟!governorofpoker3有挂wpk可以下载ios(原来真的有挂)-知乎1、玩家...
自建房八分钟!微扑克透明挂we... 自建房八分钟!微扑克透明挂wepoke有软件(一直真的有挂)-百度知乎1、微扑克透明挂系统规律教程、...