Graphql-code-generator: Ability to create GraphQLSchema

Created on 17 Oct 2018  路  4Comments  路  Source: dotansimha/graphql-code-generator

Is your feature request related to a problem? Please describe.
I want to be able to generate GraphQLSchema (.grapql) same way as I can do IntrospectionSchema (.json)

Describe the solution you'd like
gql-gen --schema http://api.gql:8080/graphql --template graphql-codegen-introspection-template --out src/app/graphql/schema.json" generates IntrospectionSchema I want to have similar option but to be able to generate the GraphQLSchema e.g:

type Note {
  _id: ID!
  createdAt: String
  updatedAt: String
}

type Query {
  allNotes: [Note]
  getNotesByUser(email: String!): [Note]
}

Describe alternatives you've considered
https://github.com/Yoctol/fetch-graphql-schema
fetch-graphql-schema http://api.server/graphql -o schema.graphql -r

plugins waiting-for-release

Most helpful comment

@marticrespi it's available now in the new API branch (called schema-ast plugin), which is in alpha now, and we'll release very soon :)

All 4 comments

sounds good, not too complicated. I'll find some time soon to implement it.
@kuncevic if you want to try to implement it and open a PR, it should be very simple - you can duplicate introspection and use print from graphql to get the GraphQLSchema as AST string.

I'm interesting on it too. It would be fantastic because we will have the types to export independently to simplify some queries or mutations.

@marticrespi it's available now in the new API branch (called schema-ast plugin), which is in alpha now, and we'll release very soon :)

Available in 0.14 馃帀

Was this page helpful?
0 / 5 - 0 ratings