Prerequisites
Before you begin, ensure you have:- Node.js 10 or higher
- npm or yarn
- Git
- A GitHub account
Getting started
Fork the repository
Fork the GraphDoc repository on GitHub.
Development setup
Project structure
Understanding the codebase structure:Building the project
GraphDoc is written in TypeScript. Compile the source:tsc -p . and compiles TypeScript files to JavaScript in-place.
The project uses
tsconfig.json with compileOnSave: true for automatic compilation in compatible IDEs.Running GraphDoc locally
After compiling, test your changes:Testing
Running tests
GraphDoc uses Jest for testing:*.test.ts or *.spec.ts patterns.
Test configuration
Frompackage.json:
Writing tests
Tests are located alongside the source files they test:Test patterns
Unit tests
Unit tests
Test individual functions and utilities:
Plugin tests
Plugin tests
Test plugin behavior with schema fixtures:
Integration tests
Integration tests
Test complete workflows with example schemas:
Test fixtures
GraphDoc includes several test schemas:test/starwars.graphql- Small GraphQL SDL schematest/github.json- Full GitHub GraphQL API introspectiontest/shopify.json- Shopify API introspectiontest/empty.schema.json- Minimal test schema
Code style
TypeScript configuration
The project uses strict TypeScript settings:Linting
GraphDoc uses TSLint (note: the project uses TSLint, not ESLint):Formatting
Prettier is configured for code formatting:.prettierrc.json.
Code conventions
Naming conventions
Naming conventions
- Use
camelCasefor variables and functions - Use
PascalCasefor classes and interfaces - Use
UPPER_CASEfor constants - Prefix interfaces with
I:IFlags,IPartials
File organization
File organization
- One class or major function per file
- Test files alongside source:
html.tsandhtml.test.ts - Export types from
interface.d.ts - Group related functionality in directories
Error handling
Error handling
- Return rejected Promises for async errors
- Use descriptive error messages
- Include context in error messages (file paths, URLs, etc.)
Making changes
Create a feature branch
Development workflow
Example documentation generation
Test with real-world schemas:package.json and use configuration files like example.github.json.
Creating plugins
If you’re contributing a new plugin:Plugin structure
Plugins must implement thePluginInterface from lib/interface.d.ts:15-120:
Plugin example
Testing plugins
Create a test file alongside your plugin:Submitting changes
Before submitting
Commit guidelines
Write clear, descriptive commit messages:- Use present tense: “Add feature” not “Added feature”
- Be specific: “Fix HTTP loader timeout handling” not “Fix bug”
- Reference issues: “Fix #123: Handle null schema types”
Creating a pull request
Describe your changes
Include:
- What the PR does
- Why the change is needed
- How to test it
- Screenshots (for UI changes)
- Related issues
Pull request template
Areas for contribution
Here are some areas where contributions are especially welcome:New features
Custom template support
Custom template support
Improve template customization and create new themes beyond the default SLDS template.
Enhanced plugins
Enhanced plugins
Create plugins for:
- Code examples generation
- API usage statistics
- Schema diff visualization
- Custom documentation sections
Schema loaders
Schema loaders
Add support for:
- GraphQL servers with custom introspection
- Schema stitching scenarios
- Federation schemas
Bug fixes
- Check open issues for bugs
- Look for issues labeled
good first issueorhelp wanted - Fix edge cases in schema loading
- Improve error messages
Documentation
- Improve README examples
- Add more inline code comments
- Create tutorials for advanced usage
- Document plugin API more thoroughly
- Add JSDoc comments to exported functions
Testing
- Increase test coverage
- Add integration tests
- Test with more real-world schemas
- Add performance benchmarks
Performance
- Optimize large schema handling
- Reduce memory usage
- Parallelize file generation
- Cache introspection results
Development tips
Debugging plugins
To debug plugin behavior:Working with templates
To create or modify templates:-
Copy the default template:
-
Edit
.mustachefiles intemplate/my-template/ -
Test your template:
- Templates use Mustache syntax
Community
Communication
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: Questions and general discussion
- Pull Requests: Code contributions and reviews
Code of conduct
Be respectful and constructive in all interactions. We want GraphDoc to be welcoming to contributors of all skill levels.Recognition
Contributors are recognized in the README. Significant contributions may result in being added as a maintainer.Release process
Only maintainers can publish releases. This section is for reference.
Getting help
If you need help contributing:- Check existing issues and pull requests
- Ask questions in GitHub Discussions
- Review the source code and existing plugins
- Look at the test files for examples
GraphDoc is maintained by @2fd and the community. Response times may vary.