Skip to content

Conversation

@jeroenvervaeke
Copy link
Member

Proposed changes

Add a new Spectral lint rule that validates that at any time, an endpoint can only have one API version marked as “upcoming”

Jira ticket: CLOUDP-313321

…dpoint can only have one API version marked as 'upcoming'
@jeroenvervaeke jeroenvervaeke requested a review from a team as a code owner April 28, 2025 16:36
@@ -0,0 +1,41 @@
module.exports = function (input) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have unit tests like we have for ipa rule sets?

https://github.com/mongodb/openapi/tree/main/tools/spectral/ipa/__tests__

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed those, didn't know it was possible! Thanks

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

@jeroenvervaeke
Copy link
Member Author

Sorry for all the commits, this change broke our linter. Telling the linter in 2 places which files to scan caused issues, I opted to keep the line in the config file so all config is in one place.

I verified that removing **/*.js by running npx eslint --debug . and verifying the scanned files.

@wtrocki
Copy link
Member

wtrocki commented May 19, 2025

@jeroenvervaeke Before we merge, let's make sure to test this with MMS.
Happy to support you with that!
It looks like you've added the function specifically for legacy rules, so we should confirm that it works as expected.

@andreaangiolillo
Copy link
Collaborator

@wtrocki Do we have a wiki with the process?

@andreaangiolillo
Copy link
Collaborator

andreaangiolillo commented May 19, 2025

@jeroenvervaeke you can use this wiki to test your changes locally.

  • (in MMS) update ./scripts/evergreen/openapi/.spectral.yaml to include the spectral in your PR:
extends:
  - spectral:oas
  - https://github.com/mongodb/openapi/blob/CLOUDP-313321/tools/spectral/.spectral.yaml
  • run
spectral lint --ruleset ./scripts/evergreen/openapi/.spectral.yaml  /server/openapi/services/openapi-mms.json --verbose

@jeroenvervaeke jeroenvervaeke merged commit a2b0638 into main May 19, 2025
8 checks passed
@jeroenvervaeke jeroenvervaeke deleted the CLOUDP-313321 branch May 19, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants