Basic usage
Commands
GraphDoc operates as a single command with various flags and options. There are no subcommands.Version command
Display the current version of GraphDoc:Help command
Display help information with all available options:Flags and options
Configuration
Path to the configuration file. GraphDoc reads configuration from the The configuration file should contain a
graphdoc property in this file.graphdoc object with your settings. Command-line flags override configuration file settings.Schema source
You must provide either--endpoint or --schema-file to specify your GraphQL schema source.
GraphQL HTTP endpoint URL for introspection. GraphDoc will query this endpoint to retrieve the schema.When using an endpoint, you can add authentication headers with
--header and query parameters with --query.Path to a GraphQL schema file. Supports multiple file formats:See Schema sources for detailed information about each format.
.json- GraphQL introspection query result.graphql,.gql,.gqls,.graphqls- GraphQL IDL/SDL files.js- JavaScript file exporting schema definition
HTTP options
These flags work in conjunction with--endpoint.
HTTP header to include in the introspection request. Use the format Common use cases include authentication tokens, API keys, and custom headers required by your GraphQL endpoint.
Name: Value. You can specify this flag multiple times for multiple headers.HTTP query string parameter to include in the introspection request. Use the format These parameters are appended to the endpoint URL as query strings.
key=value. You can specify this flag multiple times for multiple parameters.Output configuration
Directory path where the generated documentation will be written. This is the only required flag.
Delete the output directory if it already exists. Use this flag to regenerate documentation and overwrite previous builds.
Base URL path for the documentation site. Use this when hosting documentation in a subdirectory.This adjusts internal links and asset paths to work correctly when the documentation is served from a subdirectory.
Customization
Path to a plugin module. Plugins control the content displayed on documentation pages. You can specify this flag multiple times to use multiple plugins.Plugins can be:
- Built-in plugins:
graphdoc/plugins/default - npm packages:
some-package/plugin - Local files:
./lib/plugin/my-plugin.js
graphdoc/plugins/default automatically.Path to a template directory. Templates define the visual appearance and layout of the generated documentation.The default template is Salesforce Lightning Design System (SLDS). Custom templates must follow the GraphDoc template structure with Mustache files.
Inject custom data into the documentation context. Provide a JSON string that will be parsed and merged into the configuration.This data becomes available to templates and plugins. The JSON must be valid and properly escaped for your shell.
Logging
Enable verbose output. Shows detailed information about the documentation generation process, including:Useful for debugging and understanding what GraphDoc is doing.
- Plugins being loaded
- Assets being copied
- Each type being rendered
- Output directory operations
Display the GraphDoc version number and exit.
Complete examples
Exit codes
GraphDoc uses standard exit codes:0- Success: Documentation generated successfully- Non-zero - Error: Documentation generation failed
Common errors
Output directory already exists
Output directory already exists
Error message:
./docs already exists (delete it or use the --force flag)Solution: Either delete the directory manually or add the --force flag to overwrite it:Missing endpoint or schema file
Missing endpoint or schema file
Error message:
Endpoint (--endpoint, -e) or Schema File (--schema, -s) are require.Solution: You must provide either an endpoint or schema file:Missing output directory
Missing output directory
Error message:
Flag output (-o, --output) is requiredSolution: The --output flag is required:Unexpected schema extension
Unexpected schema extension
Error message:
Unexpected schema extension name: .txtSolution: GraphDoc only supports .json, .graphql, .gql, .gqls, .graphqls, and .js schema files. Convert your schema to one of these formats.HTTP error from endpoint
HTTP error from endpoint
Error message:
Unexpected HTTP Status Code 401 (Unauthorized)Solution: Add authentication headers: