我在graphql-tools中使用makeRemoteExecutableSchema来检索远程模式,然后我将它与本地模式合并 . 我想为远程模式上的类型名称添加前缀 . 是否有捷径可寻?
听起来你想做一个架构转换 .
我假设您希望使用someprefix_field_name之类的字符名前缀,就像在数据库中为表名添加前缀一样?有很多文档,首先在这个例子中:
https://github.com/hasura/schema-stitching-examples/blob/master/schema-transform/index.js
并查看graphql-tools中的函数 RenameRootFields() ,如下所示:
RenameRootFields()
https://www.apollographql.com/docs/graphql-tools/schema-transforms#Modifying-root-fields
1 回答
听起来你想做一个架构转换 .
我假设您希望使用someprefix_field_name之类的字符名前缀,就像在数据库中为表名添加前缀一样?有很多文档,首先在这个例子中:
https://github.com/hasura/schema-stitching-examples/blob/master/schema-transform/index.js
并查看graphql-tools中的函数
RenameRootFields()
,如下所示:https://www.apollographql.com/docs/graphql-tools/schema-transforms#Modifying-root-fields