【问题标题】:Alias type names of remote GraphQL schema远程 GraphQL 模式的别名类型名称
【发布时间】:2018-10-23 10:59:39
【问题描述】:

我在 graphql-tools 中使用 makeRemoteExecutableSchema 来检索远程模式,然后将其与本地模式合并。我想为远程模式上的类型名称添加一个前缀。有没有简单的方法可以做到这一点?

【问题讨论】:

    标签: graphql graphql-js graphql-tools


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-30
      • 1970-01-01
      • 2011-10-07
      • 1970-01-01
      • 2019-08-07
      • 2021-08-11
      • 2023-01-09
      • 1970-01-01
      相关资源
      最近更新 更多