是否有任何工具可以动态生成 graphQl 模式字符串? [英] Are there any tools to dynamically generate graphQl schema string?

查看:22
本文介绍了是否有任何工具可以动态生成 graphQl 模式字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将从 CMS 获得 JSON,并使用 JSON 我希望能够以编程方式编写 graphQl 模式.无需直接写字符串.

I will have JSON from a CMS and using the JSON I want to be able to programmatically write a graphQl schema. Without needing to write the string directly.

是否有任何 JavaScript 工具可以执行此操作?

Are there any JavaScript tools to do this?

我指的是 buildSchema 函数的字符串参数:

I am referring to the string argument to the buildSchema function:

http://graphql.org/code/

推荐答案

json-graphql-server 项目就是这样做的:将数据 JSON 作为输入,从数据推断类型和字段,编写一个包含类型、查询和突变的模式,并基于它启动一个 GraphQL 服务器模式.

The json-graphql-server project does that: Take a data JSON as input, infer types and fields from the data, write a schema containing types, queries and mutations, and start a GraphQL server schema based on that.

https://github.com/marmelab/json-graphql-server

我知道另一种工具只执行 JSON 到模式部分,但它不会生成查询或更改:

I know of another tool that does just the JSON to schema part, but it does not generate queries or mutations:

https://github.com/aweary/json-to-graphql

这篇关于是否有任何工具可以动态生成 graphQl 模式字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆