Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add docs #220

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/spectral-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
with:
# Path to the OpenAPI spec files and openapi/v2.yaml
file_glob: openapi/v2.yaml
spectral_ruleset: tools/spectral/.spectral.yaml
spectral_ruleset: tools/spectral/.spectral.yaml #If updated, need to update in MMS too.
andreaangiolillo marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions tools/spectral/.spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ rules:
field: allow_diff
pattern: "^true$"

no-slash-before-custom-method:
description: "Custom methods (e.g., ':applyItem') should not be preceded by a '/'."
message: "The path '{{path}}' contains a '/' before a custom method. Custom methods should not start with a '/'."
severity: error
given: "$.paths"
then:
field: "@key"
function: pattern
functionOptions:
notMatch: "/[^/]+/:[a-zA-Z]+$"

overrides:
- files: # load sample data has an issue with different path param names for different VERBS
- "*.yaml#/paths/~1api~1atlas~1v1.0~1groups~1%7BgroupId%7D~1sampleDatasetLoad~1%7BsampleDatasetId%7D"
Expand Down
11 changes: 11 additions & 0 deletions tools/spectral/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Spectral updates

If adding new rules or updating .spectral.yaml overall, the validations will instantly get updated across mongodb/openapi repository.

To propagate the changes in MMS, engineers must open a PR and update the pinned commit sha in mms.

Please perform the following steps:
1. [ ] Open a PR with the spectral changes and validate that the Spectral lint checks work.
2. [ ] Review and merge the PR.
3. [ ] Open a PR in mms, updating the commit sha of the spectral file imported.
4. [ ] Validate all tests pass.
andreaangiolillo marked this conversation as resolved.
Show resolved Hide resolved
Loading