Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ updates:
day: tuesday
commit-message:
prefix: "chore"
- package-ecosystem: npm
Copy link
Member

@wtrocki wtrocki Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: Set one of the package version -1 . post merge we can validate dependabot updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When should I do this? Now or post merge?

directory: "/tools/spectral/ipa"
schedule:
interval: weekly
day: tuesday
commit-message:
prefix: "chore"
2 changes: 1 addition & 1 deletion .github/workflows/code-health-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: |
npm run gen-ipa-docs
if [[ -n $(git status --porcelain) ]]; then
echo "IPA docs not up to date, please run 'npm run gen-ipa-docs' and commit the changes"
echo "IPA docs or NPM dependencies not up to date, please run 'npm run gen-ipa-docs' and 'npm install' then commit the changes"
exit 1
fi
exit 0
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*.env

/tools/postman/openapi
/tools/postman/node_modules
/node_modules
**/*node_modules

# Tool generated files
*.idea
Expand Down
636 changes: 36 additions & 600 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@stoplight/spectral-ruleset-bundler": "^1.6.3",
"apache-arrow": "^21.0.0",
"dotenv": "^17.2.0",
"ember-inflector": "^6.0.0",
"eslint-plugin-jest": "^29.0.1",
"inflection": "^3.0.2",
"markdown-table": "^3.0.4",
Expand Down
3 changes: 2 additions & 1 deletion tools/spectral/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# MongoDB API Spectral Validation

A set of custom validator rules for the MongoDB Atlas Programmatic API, adhering to API Standards (IPA)
A set of custom validation rules for the MongoDB Atlas Programmatic API, adhering to API Standards (IPA).

## Structure

- **/ipa** - Contains custom Spectral rulesets covering MongoDB API standards.
Expand Down
39 changes: 31 additions & 8 deletions tools/spectral/ipa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

The IPA validation uses [Spectral](https://docs.stoplight.io/docs/spectral/9ffa04e052cc1-spectral-cli) to validate the [MongoDB Atlas Admin API OpenAPI Specification](https://github.com/mongodb/openapi/tree/main/openapi). The rules cover MongoDB's [Improvement Proposal for APIs](https://mongodb.github.io/ipa/) (IPA), which are best-practices for API design.


## Quick Links

| Site | Link |
| --------------------------- | -------------------------------------------------------------------------------------------------------- |
| MongoDB API Standards (IPA) | [https://mongodb.github.io/ipa/](https://mongodb.github.io/ipa/) |
| Installation & Usage | [IPA README](https://github.com/mongodb/openapi/tree/main/tools/spectral/ipa#readme) |
| Implemented Rules | [Ruleset Documentation](https://github.com/mongodb/openapi/tree/main/tools/spectral/ipa/rulesets#readme) |
| Spectral Docs | [Spectral](https://docs.stoplight.io/docs/spectral/674b27b261c3c-overview) |
| Spectral Wiki (Internal) | [http://go/openapi-spectral-updates](http://go/openapi-spectral-updates) |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is more relevant for the legacy spectral rule, can you move the link there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or remove it. We can avoid go links as feedback I got is that they are not consistently adopted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wtrocki Lovisa and I discussed the legacy spectral ruleset a bit last week, I made a follow up ticket CLOUDP-334400 to clarify the difference between the two. Ideally we have a separate subdirectory next to the IPA one that contains the legacy rules

| Contributing | [CONTRIBUTING.md](https://github.com/mongodb/openapi/blob/main/tools/spectral/CONTRIBUTING.md) |
| Changelog | [CHANGELOG.md](https://github.com/mongodb/openapi/blob/main/tools/spectral/CHANGELOG.md) |
| Issues | [https://github.com/mongodb/openapi/issues](https://github.com/mongodb/openapi/issues) |

## Running Locally

### Prerequisites
Expand All @@ -19,12 +33,6 @@ npm run ipa-validation

This command will run Spectral CLI for the ruleset [ipa-spectral.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/ipa-spectral.yaml) on the raw [v2.yaml](https://github.com/mongodb/openapi/blob/main/openapi/.raw/v2.yaml) OpenAPI spec.

The Spectral CLI can also be used to run the validation on any valid OpenAPI file (`json` or `yaml`).

```
spectral lint {path/to/oas/file} --ruleset=./tools/spectral/ipa/ipa-spectral.yaml
```

## Integrating IPA Validations

To incorporate the IPA Spectral ruleset for OpenAPI specification validation in your repositories, you can follow these implementation approaches:
Expand All @@ -40,9 +48,17 @@ extends:
- https://raw.githubusercontent.com/mongodb/openapi/<latest-git-commit-sha>/tools/spectral/ipa/ipa-spectral.yaml
```

#### Package-based Installation
#### Package-based Installation (**TO BE RELEASED**)
Run:
```
npm install @mongodb-js/ipa-validation-ruleset
```

Not supported yet
Then reference the ruleset directly in your `.spectral.yaml` file:
```
extends:
- "@mongodb-js/ipa-validation-ruleset"
```

### Integration Methods

Expand All @@ -55,6 +71,13 @@ extends:
- https://raw.githubusercontent.com/mongodb/openapi/<latest-git-commit-sha>/tools/spectral/ipa/ipa-spectral.yaml
```

or

```
extends:
- "@mongodb/ipa-validation-ruleset"
```

For more information about how to extend rulesets, see the [web page](https://meta.stoplight.io/docs/spectral/83527ef2dd8c0-extending-rulesets).

#### Customization Options
Expand Down
Loading
Loading