我在graphql-tools中使用makeRemoteExecutableSchema来检索远程模式,然后我将它与本地模式合并。我想为远程模式上的类型名称添加前缀。有一个简单的方法吗?
答案 0 :(得分:0)
想要进行模式转换的声音。
我假设您想为字段名加上诸如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