热巧克力GraphQl方法版本
我如何实现与 REST 类似的 Hot Chocolate GraphQL 方法版本控制,即 /graphql/v1 或使用请求标头。我不想使用弃用字段,因为输入或输出参数没有任何更改,但我在方法实现方面进行了更改(业务方面)。
How i can implement the Hot Chocolate GraphQL method versioning similar like to REST, i.e. /graphql/v1 or using request header. i don't want to use Deprecating fields because there is no any change in input or out param but i have change in method implementation(business wise).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GraphQl没有版本控制的概念。您倾向于做的是弃用并以新名称引入新方法。
热巧克力可以暴露多个模式,因此您可以在同一台服务器上托管两个单独的模式。
services.addgraphqlserver(“ a”)
services.addgraphqlserver(“ b”)
在
mapgraphql
方法中,您需要将特定的模式映射到特定路由。app.mapgraphql(“/graphql/a”,schemaname:“ a”)
具有多个模式的版本不会很好地扩展,而您介绍的越多,它就会越难。
GraphQL has no concept of versioning. What you would tend to do is still deprecate and introduce a new method under a new name.
Hot Chocolate can expose multiple schemas though, so you can host two separate schemas on the same server.
services.AddGraphQLServer("a")
services.AddGraphQLServer("b")
in the
MapGraphQL
method, you would need to map a specific schema to a specific route.app.MapGraphQL("/graphql/a", schemaName: "a")
Having multiple versions of the schema will not scale very well and the more you introduce of these the harder it will get.