'GraphQL: Generate static documentation from SDL file

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?



Solution 1:[1]

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.

Solution 2:[2]

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

Solution 3:[3]

There are now 2 more recent open source projects to do that.

Both support creating static docs from SDL files or introspection query.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Rearden
Solution 2 Olivier
Solution 3 Sunny Pelletier