Are there any tools to dynamically generate graphQl schema string?

前端 未结 2 795
时光说笑
时光说笑 2021-02-10 03:04

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.

Are there any

2条回答
  •  野性不改
    2021-02-10 03:12

    It depends on how does your JSON files look like. For me I had a similar case - a kind of complex json definition file - and I built my own json to graphql-js converter here

    • After building your server you can generate the schema string in .graphql file using this package gql-tools, using this command - after launching the server - :-

      gqlschema http://localhost:3000/graphql -t

    • Use the schema string along with graphql-server-express from apollo and link it with resolvers

提交回复
热议问题