Thank you for your interest in contributing to GeniusTechSpace API Contracts! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Process
- Proto Style Guide
- Submitting Changes
- Release Process
We are committed to providing a welcoming and inclusive environment. Please be respectful and constructive in all interactions.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/api-contracts.git cd api-contracts - Run setup:
./scripts/setup.sh
- Create a branch:
git checkout -b feature/your-feature-name
- Create proto directory:
proto/SERVICE_NAME/v1/ - Define your service in
service.proto - Define messages in separate files (e.g.,
types.proto,requests.proto) - Update client configurations
- Generate and test clients
- Submit PR
- Check if change is breaking using
buf breaking - If breaking, create new version (
v2/) - Update documentation
- Generate clients
- Update examples
- Submit PR
proto/SERVICE_NAME/v1/
├── service.proto # Service definition
├── types.proto # Message types
├── requests.proto # Request messages
└── responses.proto # Response messages
- Package names:
geniustechspace.SERVICE.v1 - Service names: PascalCase (e.g.,
UserService) - RPC names: PascalCase (e.g.,
GetUser) - Message names: PascalCase (e.g.,
UserProfile) - Field names: snake_case (e.g.,
user_id) - Enum names: SCREAMING_SNAKE_CASE (e.g.,
USER_STATUS_ACTIVE)
All proto elements must have documentation:
// UserService manages user profiles and accounts.
// Provides CRUD operations and search functionality.
service UserService {
// Get user profile by ID.
// Returns USER_NOT_FOUND if user doesn't exist.
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
option (google.api.http) = {
get: "/v1/users/{user_id}"
};
}
}- Reserve
1-15for frequently used fields (1-byte encoding) - Use
16+for less frequently used fields - Never reuse field numbers
- Reserve deprecated field numbers:
reserved 2, 15, 9 to 11; reserved "old_field_name";
Follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringtest: Adding testschore: Maintenance tasks
Examples:
feat(auth): add MFA support
fix(payments): correct currency conversion
docs(readme): update installation instructions
- Update documentation for any user-facing changes
- Add tests if applicable
- Run linters:
buf lint - Check for breaking changes:
buf breaking --against '.git#branch=main' - Generate clients:
./scripts/generate_clients.sh - Create PR with clear description
- Respond to feedback from reviewers
## Description
Brief description of changes
## Type of Change
- [ ] New feature
- [ ] Bug fix
- [ ] Breaking change
- [ ] Documentation update
## Testing
Describe how changes were tested
## Checklist
- [ ] Proto files documented
- [ ] Clients generated successfully
- [ ] Tests pass
- [ ] No breaking changes (or version bumped)
- [ ] Documentation updatedWe use Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes
- Update version in relevant files
- Update CHANGELOG.md
- Create and push tag:
git tag -a v0.2.0 -m "Release v0.2.0" git push origin v0.2.0 - CI automatically:
- Builds clients
- Runs tests
- Publishes packages
- Creates GitHub release
- Open an issue
- Start a discussion
- Email: dev@geniustechspace.com
Thank you for contributing! 🎉