Skip to content

Commit 41f4720

Browse files
CLOUDP-278403: Spectral README update for linting/OAS changes
1 parent 9a57d3a commit 41f4720

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

tools/spectral/.spectral.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ rules:
174174
functionOptions:
175175
match: "^(mms)$"
176176
message: "'additionalServices' must be 'mms' as no other services are supported."
177-
177+
178178
no-slash-before-custom-method:
179179
description: "Custom methods (e.g., ':applyItem') should not be preceded by a '/'."
180180
message: "The path '{{path}}' contains a '/' before a custom method. Custom methods should not start with a '/'."

tools/spectral/README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
# Spectral updates
22

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

5-
To propagate the changes in MMS, engineers must open a PR and update the pinned commit sha in mms.
5+
To propagate the changes in MMS, engineers must open an MMS PR and update the pinned commit SHA for the imported spectral file from `mongodb/openapi`.
6+
7+
## Scenarios
8+
9+
There are two scenarios depending on the changes you are making to `.spectral.yaml` and whether it affects the currently published OAS or not.
10+
11+
### Scenario 1: The current OAS doesn't violate the new linting
612

713
Please perform the following steps:
8-
1. [ ] Open a PR with the spectral changes and validate that the Spectral lint checks work.
9-
2. [ ] Review and merge the PR.
10-
3. [ ] Open a PR in mms, updating the commit sha of the spectral file imported.
11-
4. [ ] Validate all tests pass.
14+
15+
1. Open a `mongodb/openapi` PR with the changes to `tools/spectral/.spectral.yaml`
16+
2. Validate that the new Spectral lint checks pass
17+
3. Review and merge the PR
18+
4. Open a PR in MMS, updating the commit SHA of the imported spectral file
19+
5. Validate all tests pass
20+
6. Review and merge the MMS PR
21+
22+
### Scenario 2: The current OAS violates the new linting
23+
24+
There are cases when updating the MMS OAS and the `.spectral.yaml` in `mongodb/openapi` that will cause the spectral linting to fail, because the current published OAS violates the new spectral rules. Changes in the MMS OAS will not be reflected until the next release. In this case please perform the following steps:
25+
26+
1. Open a PR in MMS with the OAS changes and updating the MMS `.spectral.yaml` with the new/changed rules
27+
2. If the current `mongodb/openapi` spectral rules will violate the OAS changes, open a PR in `mongodb/openapi` and update/disable any rules that will fail
28+
3. Validate that the Spectral lint passes in `mongodb/openapi` and in MMS
29+
4. Review and merge both PRs
30+
5. Wait for the next release when the published OAS is updated
31+
6. Open a `mongodb/openapi` PR updating the linting `spectral-lint.yaml` with the linting changes initially added to MMS
32+
7. Validate that all tests pass
33+
8. Review and merge the PR
34+
9. Open a PR in MMS, updating the commit SHA of the imported spectral file, and removing any rules that were added to `mongodb/openapi`
35+
10. Validate all tests pass
36+
11. Review and merge the MMS PR
37+
38+
The end goal is for the `.spectral.yaml` in `mongodb/openapi` to contain all rules for the linting. The published OASes in each environment should comply with those rules.

0 commit comments

Comments
 (0)