Skip to content

Commit 78f6ad5

Browse files
authored
Merge branch 'main' into CLOUDP-302671-3
2 parents 4d1cf96 + 2a761db commit 78f6ad5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2612
-260
lines changed

.github/workflows/spectral-lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ jobs:
2929
sparse-checkout: |
3030
openapi/
3131
tools/spectral
32+
- name: Setup Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '20.x'
36+
cache: 'npm'
37+
- name: Install npm dependencies
38+
run: npm install
3239
- name: Spectral action
3340
uses: stoplightio/spectral-action@2ad0b9302e32a77c1caccf474a9b2191a8060d83
3441
with:

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run lint-staged to process only changed JS files
5+
npx lint-staged

.lintstagedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"**/*.{js,jsx,ts,tsx,json,md}": ["prettier --write"],
3+
"**/*.js": ["jest --findRelatedTests --passWithNoTests"],
4+
"tools/spectral/ipa/**/*.yaml": ["node tools/spectral/ipa/scripts/generateRulesetReadme.js"],
5+
"**/*.go": ["./tools/cli/precommit.sh"]
6+
}

CONTRIBUTING.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Contributing to MongoDB OpenAPI Project
2+
3+
## Development Setup
4+
5+
### Prerequisites
6+
7+
- Node.js v20 or later
8+
- npm v8 or later
9+
- Git
10+
- Go 1.21 or later (for CLI development)
11+
12+
### Installation
13+
14+
1. Clone the repository:
15+
```bash
16+
git clone https://github.com/your-username/mongodb-openapi.git
17+
cd mongodb-openapi
18+
```
19+
20+
2. Install dependencies:
21+
```bash
22+
npm install
23+
```
24+
25+
3. Set up Git hooks (recommended):
26+
```bash
27+
npm run precommit
28+
```
29+
30+
4. If working on the Go CLI, set up the Go environment:
31+
```bash
32+
cd tools/cli
33+
make setup
34+
```
35+
36+
This will install Husky, which manages Git hooks for the project. The hooks ensure code quality by automatically running various checks before commits.
37+
38+
## Development Workflow
39+
40+
### Git Hooks
41+
42+
This project uses the following Git hooks:
43+
44+
- **pre-commit**:
45+
- Automatically formats your code using Prettier and runs tests for staged JavaScript files
46+
- 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 run `chmod ug+x .husky/*` to make it executable.
47+
- For Go files, runs formatting, linting, and tests using the project's Makefile
48+
49+
### Available Scripts
50+
51+
#### JavaScript/Node.js
52+
- `npm run format` - Format all files with Prettier
53+
- `npm run format-check` - Check formatting without modifying files
54+
- `npm run lint-js` - Lint JavaScript files
55+
- `npm run test` - Run all tests
56+
57+
#### IPA specific targets
58+
- `npm run gen-ipa-docs` - Generate IPA ruleset documentation (see `./tools` folder for more information)
59+
- `npm run ipa-validation` - Run OpenAPI validation with Spectral
60+
61+
#### Go OpenAPI CLI (internal)
62+
When working in the `tools/cli` directory:
63+
- `make fmt` - Format Go code
64+
- `make lint` - Run golangci-lint
65+
- `make unit-test` - Run Go unit tests
66+
- `make e2e-test` - Run end-to-end tests
67+
- `make build` - Build the CLI binary
68+
- `make gen-docs` - Generate CLI documentation

changelog/internal/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"runDate": "2025-03-10",
2+
"runDate": "2025-03-11",
33
"specRevision": "039e6ac71118273c1be2ea529b26035b1b884a00",
44
"specRevisionShort": "039e6ac7111",
55
"versions": [

0 commit comments

Comments
 (0)