Contributing to ModelGraphGenerator
We welcome contributions from the community! Whether you're fixing a bug, adding a feature, improving documentation, or writing tests, your help is appreciated.
Code of Conduct
Please read and follow our Code of Conduct. We expect all contributors to treat each other with respect and create a welcoming environment.
Getting Started
1. Fork and Clone
# Fork on GitHub, then:
git clone https://github.com/YOUR_USERNAME/ModelGraphGenerator.git
cd ModelGraphGenerator
2. Build
swift build
3. Run Tests
swift test
All 327+ tests should pass before you start making changes.
4. Create a Branch
git checkout -b feature/my-new-feature
# or
git checkout -b fix/issue-123
Development Workflow
Making Changes
- Make your changes in a focused, logical commit
- Write or update tests for any changed behavior
- Run
swift testto ensure all tests pass - Run
swift buildto ensure it compiles cleanly
Code Style
- Follow Swift API design guidelines
- Use
swiftformatfor consistent formatting (runswift package plugin --allow-writing-to-package-directory format) - Prefer
letovervarwhere possible - Use descriptive names — clarity over brevity
Writing Tests
Tests live in Tests/. Structure mirrors Sources/:
Tests/Unit/— Unit tests for individual componentsTests/Integration/— End-to-end tests running the full pipeline
When adding a new feature, add:
- Unit tests in the appropriate
Tests/Unit/subdirectory - Integration test if the feature affects end-to-end output
Test naming convention:
func test_extractsMinLengthConstraint_whenPropertyHasMinLength() { ... }
func test_emitsOneOf_forPolymorphicProperty() { ... }
Commit Messages
Follow Conventional Commits:
feat: add @ChimeraProperty example parameter support
fix: correctly handle optional array properties
docs: improve CLI flags documentation
test: add missing tests for CodingKeys renaming
refactor: simplify TypeAnalyzer enum mapping
Submitting a Pull Request
- Push your branch to your fork
- Open a pull request against
mainonPhonePe/ModelGraphGenerator - Fill in the PR template — describe what changed and why
- Ensure CI passes (build + tests)
- Request a review from a maintainer
PR Checklist
- Tests added/updated for all changed behavior
-
swift testpasses locally -
swift buildproduces no warnings - Commit messages follow Conventional Commits
- Documentation updated if adding a new feature or flag
Reporting Issues
Use GitHub Issues to report bugs or request features.
Bug Reports
Include:
- ModelGraphGenerator version (
model-graph-generator --version) - Swift version (
swift --version) - macOS version (
sw_vers) - Minimal reproduction case: the smallest Swift snippet that triggers the bug
- Expected vs. actual behavior
Feature Requests
Describe:
- The use case you're trying to solve
- What annotation or CLI change would address it
- Any alternatives you've considered
Questions
For questions and discussions, use GitHub Discussions.
For security issues, email sharang.verma@phonepe.com directly (do not open a public issue).
License
By contributing, you agree that your contributions will be licensed under the MIT License.