1
votes

The NPM library graphql-docs will statically generate GraphQL API documentation from a successful schema introspection call against the API server.

I need to similarly generate GraphQL API documentation, but based on an SDL file rather than from an introspection call.

I know I can generate a server stub from my SDL at built time and introspect against that, but this seems like overkill.

Is there a library or a tool-chain, in any language, that makes generating docs from an SDL file simple?

2
FWIW, if you do end up going with graphql-docs, I've got a fork that offers a more complete solution here: github.com/danielrearden/graphql-docs - Daniel Rearden
Can we add sample query and mutation req & resp to the generated files usinggraphql-docs? Recently I installed and used graphql-docs and can generate files but the files were only having the query,mutation names and the description of the object attributes etc. I need to add some sample queries and responses as well - Rini

2 Answers

3
votes

I've messed around with graphdoc before, which can generate static documentation from an SDL file, JSON or even graphql-tools' executableSchema. I don't think there's a lot of other tools out there, since most teams just rely on GraphiQL or GraphQL Playground for their documentation needs.

1
votes

I recommend https://github.com/2fd/graphdoc to generate a static doc of a GraphQL endpoint.