Nestjs GraphQl不一致的Autoschemafile和服务SQL

发布于 2025-02-13 20:23:26 字数 858 浏览 0 评论 0原文

我正在将Nestjs与ApollofeDerationDriver一起使用。我还添加了一些带有变换选项的前缀。问题是,在SDL中,我看不到那个前缀,但是在他的自动化学中。这是一个问题,因为我无法在此微服务和网关之间创建连接。

 @Module({
  imports: [
    GraphQLModule.forRoot<ApolloDriverConfig>({
      autoSchemaFile: 'src/graphql/schema.gql',
      driver: ApolloFederationDriver,
      plugins: [
        ApolloServerPluginLandingPageLocalDefault(),
        ApolloServerPluginInlineTraceDisabled(),
      ],
      sortSchema: true,
      transformSchema: <some_transforms>,
      transformAutoSchemaFile: true,
    }),
  ],
})

来自schema.gql文件的示例

type Query {
  prefix_getSomeData(filter: prefix_FilterInput)
}

和SDL( Query apollogetservicedefinition {_service {sdl}} )中的同一查询

type Query {
  getSomeData(filter: FilterInput)
}

I'm using nestJS with ApolloFederationDriver. I also add some prefix with transformSchema option. The issue is that in sdl I can't see that prefix, but in the autoSchemaFile he is. It is a problem, because I can't create connection between this microservice and Gateway.

 @Module({
  imports: [
    GraphQLModule.forRoot<ApolloDriverConfig>({
      autoSchemaFile: 'src/graphql/schema.gql',
      driver: ApolloFederationDriver,
      plugins: [
        ApolloServerPluginLandingPageLocalDefault(),
        ApolloServerPluginInlineTraceDisabled(),
      ],
      sortSchema: true,
      transformSchema: <some_transforms>,
      transformAutoSchemaFile: true,
    }),
  ],
})

Example from the schema.gql file

type Query {
  prefix_getSomeData(filter: prefix_FilterInput)
}

And the same query in the sdl(query ApolloGetServiceDefinition { _service { sdl } })

type Query {
  getSomeData(filter: FilterInput)
}

How I can add prefix to the sdl file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文