Contributing to MongoDB OpenAPI Project
August 1, 2025 ยท View on GitHub
Development Setup
Prerequisites
- Node.js v20 or later
- npm v8 or later
- Git
- Go 1.21 or later (for CLI development)
Installation
-
Clone the repository:
git clone https://github.com/your-username/mongodb-openapi.git cd mongodb-openapi -
Install dependencies:
npm install -
Set up Git hooks (recommended):
npm run precommit -
If working on the Go CLI, set up the Go environment:
cd tools/cli make setup
This will install Husky, which manages Git hooks for the project. The hooks ensure code quality by automatically running various checks before commits.
Development Workflow
Git Hooks
This project uses the following Git hooks:
- pre-commit:
- Automatically formats your code using Prettier and runs tests for staged JavaScript files
- If you get the message
hint: The '.husky/pre-commit' hook was ignored because it's not set as executable.during the commit, you can runchmod ug+x .husky/*to make it executable. - For Go files, runs formatting, linting, and tests using the project's Makefile
Available Scripts
JavaScript/Node.js
npm run format- Format all files with Prettiernpm run format-check- Check formatting without modifying filesnpm run lint-js- Lint JavaScript filesnpm run test- Run all tests
IPA specific targets
npm run gen-ipa-docs- Generate IPA ruleset documentation (see./toolsfolder for more information)npm run ipa-validation- Run OpenAPI validation with Spectral
Go OpenAPI CLI (internal)
When working in the tools/cli directory:
make fmt- Format Go codemake lint- Run golangci-lintmake unit-test- Run Go unit testsmake e2e-test- Run end-to-end testsmake build- Build the CLI binarymake gen-docs- Generate CLI documentation
Note: Please ensure the usage of conventional commits in PR titles