gpt4 book ai didi

typescript - 如何使用 Apollo Rover + Codegen 生成 typescript schema 类型

转载 作者:行者123 更新时间:2023-12-05 02:39:01 25 4
gpt4 key购买 nike

我很难理解如何使用 Apollo Rover连同Apollo Codegen为我的 API 架构生成我的 typescript 类型。我在 apollo studio 中注册了我的模式,并且可以将模式抓取到 GQL 文件中,但看起来 Rover CLI 不支持 codegen,因此我需要使用旧版 Apollo CLI。然而,Apollo CLI 希望从远程端点获取模式而不是注册模式,并希望模式为 JSON 格式,但 Rover 仅以 .gql 格式获取。

我对我“应该”如何将其连接起来感到困惑,这样我就可以将 apollo codegen 与我注册的模式一起使用,而无需进行大量手动转换工作。

最佳答案

我找到了这个。我认为您应该继续使用 Apollo CLI。

enter image description here

Rover does not currently provide client-specific features, such ascode generation or client checks. For these features, continue usingthe Apollo CLI.

使用另一种解决方案,它对我有用;)

https://github.com/dotansimha/graphql-code-generator

关于typescript - 如何使用 Apollo Rover + Codegen 生成 typescript schema 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69287539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com