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

查看:68
本文介绍了是否有任何工具可以动态生成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天全站免登陆